From Test-Scratch-Wiki

This will help you make a Game or interactive Animation with the arrow keys.

X-Y Method

This is the easiest way to do this. First, go to the sprite you want to make move. Then add these scripts:

when [up arrow v] key pressed
change y by (10)
when [down arrow v] key pressed
change y by (-10)
when [right arrow v] key pressed
change x by (10)
when [left arrow v] key pressed
change x by (-10)

Now, the sprite will stay in one direction while it moves around.

Steps Method

Using these scripts, the sprite will turn around while it moves. This is not recommended in a sprite that must turn for other reasons.

when [up arrow v] key pressed
point in direction (0 v)
move (10) steps
when [down arrow v] key pressed
point in direction (180 v)
move (10) steps
when [right arrow v] key pressed
point in direction (90 v)
move (10) steps
when [left arrow v] key pressed
point in direction (-90 v)
move (10) steps

Now your sprite will turn when it moves. If you do not want the user to see it turn, add

when gf clicked
set rotation style [don't rotate v]

If you only want the user to see it go left or right, add

when gf clicked
set rotation style [left-right v]
Cookies help us deliver our services. By using our services, you agree to our use of cookies.