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

#1 2011-06-19 20:04:55

CommanderFresh
New Scratcher
Registered: 2011-06-19
Posts: 1

Changing a sprite's direction based on movement?

Hello,

I've used Scratch for a while now, and I was wondering if there was any way to change the direction a sprite faces based on its direction of movement or key presses? I've been looking around for a while now and haven't been able to come up with a solution. I'd appreciate it if someone could tell me.


Thanks in advance!

Offline

 

#2 2011-06-19 20:12:49

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Changing a sprite's direction based on movement?

Do you mean something like this?

http://i.imgur.com/fdHxf.gif
This would make a sprite turn depending on which key the user presses.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2011-06-19 20:12:58

techdoodle
Scratcher
Registered: 2010-10-08
Posts: 21

Re: Changing a sprite's direction based on movement?

[blocks]<when[ ]key pressed><move(  )steps><turn cw(  )degrees>[/blocks]  or  [blocks]<when green flag clicked><forever><point in direction( <x position>[/blocks]


http://i.picasion.com/pic48/ee5dbb3c993d0986e1efcd07168078ad.gif Click to play!

Offline

 

#4 2011-06-19 20:13:04

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Changing a sprite's direction based on movement?

So you want the sprite to face the direction it's going?

Here's an engine for it:  http://scratch.mit.edu/projects/Kileyme … est/946516


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

Board footer