Discuss Scratch

cs4272678
Scratcher
5 posts

How can I make my sprite face where it's walking with left and right arrow keys?

I don't know how to do this, and I need this feature for a game I'm trying to make. this is what I have ;


when green flag clicked
set rotation style [all around]
forever
if <key [right arrow] pressed?> then
move (10) steps
next costume

end
if <key [ left arrow] pressed?> then
move (-10) steps
next costume
end
end
And so on.
If anybody can help me please leave a tip or how to do this.
Sorry if this is basic stuff, I just joined scratch about 2 weeks ago.
lovepeacekindness
Scratcher
16 posts

How can I make my sprite face where it's walking with left and right arrow keys?

I can help! It's kinda `hard to do it on here but ill make a project
amiable_dolphin
Scratcher
500+ posts

How can I make my sprite face where it's walking with left and right arrow keys?

Hi I can help you!
Firstly, this topic should go under Help with scripts column not requests. Nvm, here is the code:
when green flag clicked
set rotation style [left-right v]
when [ right arrow v] key pressed
point in direction (90 v)
forever
move (1) steps
next costume
end
when [ left arrow v] key pressed
point in direction (-90 v)
forever
move (1) steps
next costume
end
Please note, this works only if the original sprite is facing towards right. If it is facing left, change 90 to -90 and -90 to 90
Try this, it should work
lovepeacekindness
Scratcher
16 posts

How can I make my sprite face where it's walking with left and right arrow keys?

Powered by DjangoBB