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

#1 2012-11-29 13:51:37

d14a248
New Scratcher
Registered: 2012-11-29
Posts: 1

motion in direction of sprite

I want to create a game in which the sprite moves in the direction its pointing after a rotation.

So after this:

when [left arrow] key pressed
turn ccw (5) degrees
the direction is 85 degrees

And I cannot figure out how to move the sprite in this direction.

Thanks!

Offline

 

#2 2012-11-30 15:13:50

rlojunior
Scratcher
Registered: 2010-08-11
Posts: 59

Re: motion in direction of sprite

d14a248 wrote:

I want to create a game in which the sprite moves in the direction its pointing after a rotation.

So after this:

when [left arrow] key pressed
turn ccw (5) degrees
the direction is 85 degrees

And I cannot figure out how to move the sprite in this direction.

Thanks!

See if this script can helps you.

when gf clicked
forever
if <key [left arrow] pressed?>
move (0) steps
turn ccw (5) degrees
else
move (5) steps

Offline

 

#3 2012-11-30 15:58:11

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

Re: motion in direction of sprite

rlojunior wrote:

d14a248 wrote:

I want to create a game in which the sprite moves in the direction its pointing after a rotation.

So after this:

when key [left arrow v] pressed
turn ccw (5) degrees
the direction is 85 degrees

And I cannot figure out how to move the sprite in this direction.

Thanks!

See if this script can helps you.

when gf clicked
forever
if <key [left arrow v] pressed?>
turn ccw (5) degrees
else
move (5) steps
end

Fixed and removed an unneccesary block.

Last edited by ErnieParke (2012-11-30 15:58:46)


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

Offline

 

Board footer