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

#1 2012-07-22 10:16:08

Angelflower0
Scratcher
Registered: 2012-07-20
Posts: 8

help me with script

how do you move a animal with arrow keys?

Offline

 

#2 2012-07-22 10:20:58

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: help me with script

Ok Angelflower0, this is the script. 

when clicked
forever
if
key
up arrow
pressed?
point in direction
0
move
number of steps you want
steps
if
key
down arrow
pressed?
point in direction
180
move
number of steps you want
steps
if
key
right arrow
pressed?
point in direction
90
move
number of steps you want
steps
if
key
left arrow
pressed?
point in direction
-90
move
number of steps you want
steps

Last edited by Firedrake969 (2012-07-22 10:21:55)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#3 2012-07-22 11:07:16

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

Re: help me with script

Or you could use this:

when clicked
forever
if
key
left arrow
pressed?
change x by
-10
This number will determine how fast the sprite moves.
if
key
right arrow
pressed?
change x by
10
if
key
up arrow
pressed?
change y by
10
if
key
down arrow
pressed?
change y by
-10

Last edited by JH1010 (2012-07-22 11:08:03)

Offline

 

#4 2012-07-22 11:10:11

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: help me with script

JH1010 wrote:

Or you could use this:

when clicked
forever
if
key
left arrow
pressed?
change x by
-10
This number will determine how fast the sprite moves.
if
key
right arrow
pressed?
change x by
10
if
key
up arrow
pressed?
change y by
10
if
key
down arrow
pressed?
change y by
-10

Angelflower, if you want it pointed in a certain direction, use my script.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#5 2012-07-22 11:29:42

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

Re: help me with script

Or:

when clicked
forever
if
key
up arrow
pressed?
move
how fast you want to move
steps
if
key
down arrow
pressed?
move
how fast you want to move backward [note: be sure that this number is negative.]
steps
if
key
right arrow
pressed?
turn
how fast you want to turn
degrees
if
key
left arrow
pressed?
turn
how fast you want to turn
degrees

this will move in the direction you are pointing, and you use the left and right arrow keys to turn.


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

Offline

 

Board footer