This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-08-02 14:19:36

Pluroblox
New Scratcher
Registered: 2012-07-31
Posts: 8

Moving a character left.

How do i do it?

Offline

 

#2 2012-08-02 14:22:46

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Moving a character left.

Use negative numbers in your inputs.  wink

change x by
-1
move
-1
steps


http://i50.tinypic.com/312u714.jpg

Offline

 

#3 2012-08-13 12:26:53

powermario67
Scratcher
Registered: 2012-07-02
Posts: 61

Re: Moving a character left.

do you play roblox?


~~~~~~~~ Pico Gaming Inc. ~~~~~~~~

Offline

 

#4 2012-08-13 13:22:26

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: Moving a character left.

What does that have to do with... anything?


http://i47.tinypic.com/2iaa73k.png

Offline

 

#5 2012-08-14 18:58:59

powermario67
Scratcher
Registered: 2012-07-02
Posts: 61

Re: Moving a character left.

his scratch username :3


~~~~~~~~ Pico Gaming Inc. ~~~~~~~~

Offline

 

#6 2012-08-15 08:51:55

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Moving a character left.

when clicked
forever
wait until
key
left
pressed?
set
X Velocity
to
-7
repeat until
not
key
left arrow
pressed?
change x by
X Velocity
repeat until
X Velocity
>
-0.1
set
X Velocity
to
X Velocity
*
0.98
change x by
X Velocity
set
X Velocity
to
0

It should work.  wink

Last edited by jontmy00 (2012-08-15 08:53:27)


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#7 2012-08-15 14:00:15

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Re: Moving a character left.

jontmy00 wrote:

when clicked
forever
wait until
key
left
pressed?
set
X Velocity
to
-7
repeat until
not
key
left arrow
pressed?
change x by
X Velocity
repeat until
X Velocity
>
-0.1
set
X Velocity
to
X Velocity
*
0.98
change x by
X Velocity
set
X Velocity
to
0

It should work.  wink

Or:

when clicked
forever
if
key
left arrow
pressed?
change x by
-1

Last edited by JH1010 (2012-08-15 14:01:10)

Offline

 

#8 2012-08-15 14:18:58

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Moving a character left.

JH1010 wrote:

jontmy00 wrote:

when clicked
forever
wait until
key
left
pressed?
set
X Velocity
to
-7
repeat until
not
key
left arrow
pressed?
change x by
X Velocity
repeat until
X Velocity
>
-0.1
set
X Velocity
to
X Velocity
*
0.98
change x by
X Velocity
set
X Velocity
to
0

It should work.  wink

Or:

when clicked
forever
if
key
left arrow
pressed?
change x by
-1

Fixed.


http://i46.tinypic.com/35ismmc.png

Offline

 

#9 2012-08-15 15:00:50

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Moving a character left.

Here's what I usually use:

when clicked
forever
if
key
left arrow
pressed?
and
abs
of
x velocity
<
10
change
x velocity
by
-0.85
if
key
right arrow
pressed?
and
abs
of
x velocity
<
10
change
x velocity
by
0.85
set
x velocity
to
x velocity
*
0.89
change x by
x velocity

Last edited by henley (2012-08-16 14:34:09)


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#10 2012-08-16 10:42:17

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Re: Moving a character left.

Why do people overcomplicate themselves with x/y velocities?

Offline

 

#11 2012-08-16 10:51:33

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: Moving a character left.

JH1010 wrote:

Why do people overcomplicate themselves with x/y velocities?

Well, they're smoother, and once you get used to them, they aren't too complicated...

But yes, the most basic moving left would be

move
negative number
steps

or
change x by
negative number


http://i48.tinypic.com/2072ctw.gif

Offline

 

#12 2012-08-16 11:05:14

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Moving a character left.

JH1010 wrote:

Why do people overcomplicate themselves with x/y velocities?

It's not overcomplicated if you know how it works and what you're doing. It creates a much better, smoother sense of movement making it better than the choppy, immediate movement that you're limited to otherwise.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#13 2012-08-16 14:01:05

OverPowered
Scratcher
Registered: 2012-07-27
Posts: 100+

Re: Moving a character left.

henley wrote:

Here's what I usually use:

when clicked
forever
if
key
left arrow
pressed?
and
abs
of
x velocity
<
10
change
x velocity
by
-0.85
if
key
right arrow
pressed?
and
abs
of
x velocity
<
10
change
x velocity
by
0.85
set
x velocity
to
x velocity
*
0.89
set x to
x velocity

Instead of

set x to
x velocity

did you mean
change x by
x velocity

Also, I believe it could be simplified to
when clicked
set
XVelocity
to
0
forever
if
abs
of
XVelocity
<
10
if
key
left arrow
pressed?
change
XVelocity
by
-1
if
key
right arrow
pressed?
change
XVelocity
by
1
set
XVelocity
to
XVelocity
*
0.9
change x by
XVelocity

{Sorry for any typos, can't edit posts.}


Newest project: Tunnel TEST ~http://blocks.scratchr.org/API.php?user=OverPowered&amp;action=onlineStatus~ On my mind: Unicameralism

Offline

 

#14 2012-08-16 14:33:52

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Moving a character left.

Oh, oops. I meant [change x by (x velocity)], I typo'd.  tongue

And you're right. I wonder why no one else has thought of that.  yikes  You must be magic.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#15 2012-08-16 14:40:59

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Moving a character left.

OverPowered wrote:

Also, I believe it could be simplified to

when clicked
set
XVelocity
to
0
forever
if
abs
of
XVelocity
<
10
if
key
left arrow
pressed?
change
XVelocity
by
-1
if
key
right arrow
pressed?
change
XVelocity
by
1
set
XVelocity
to
XVelocity
*
0.9
change x by
XVelocity

Actually you dont need to use "abs" to limit the velocity. The "set velocity to" part of the script will limit the velocity itself.

when clicked
set
XVelocity
to
0
forever
if
key
left arrow
pressed?
change
XVelocity
by
-1
if
key
right arrow
pressed?
change
XVelocity
by
1
set
XVelocity
to
XVelocity
*
0.9
change x by
XVelocity


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#16 2012-08-16 14:49:58

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Moving a character left.

I have learnt so much today.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#17 2012-08-16 15:05:38

OverPowered
Scratcher
Registered: 2012-07-27
Posts: 100+

Re: Moving a character left.

Wes64 wrote:

OverPowered wrote:

Also, I believe it could be simplified to

when clicked
set
XVelocity
to
0
forever
if
abs
of
XVelocity
<
10
if
key
left arrow
pressed?
change
XVelocity
by
-1
if
key
right arrow
pressed?
change
XVelocity
by
1
set
XVelocity
to
XVelocity
*
0.9
change x by
XVelocity

Actually you dont need to use "abs" to limit the velocity. The "set velocity to" part of the script will limit the velocity itself.

when clicked
set
XVelocity
to
0
forever
if
key
left arrow
pressed?
change
XVelocity
by
-1
if
key
right arrow
pressed?
change
XVelocity
by
1
set
XVelocity
to
XVelocity
*
0.9
change x by
XVelocity

However, the "abs" portion of the script prevents the player from actively increasing their velocity over a value, much like

if
set
XVelocity
to
10
if
set
XVelocity
to
-10

which is fine and well, except that the "abs" script is shorter and passively allows the player to be "flung" at faster than the maximum speed.
Anyways, if it needs no limit, your script is more efficient. ^^


Newest project: Tunnel TEST ~http://blocks.scratchr.org/API.php?user=OverPowered&amp;action=onlineStatus~ On my mind: Unicameralism

Offline

 

Board footer