Discuss Scratch

Flickerflight02
Scratcher
57 posts

Pointing in direction

So I have a sprite that randomly moves around the screen (using the glide block) and would like it to point in the direction it's going. How can I do this? Thanks for your help :3
karmanhof
Scratcher
41 posts

Pointing in direction

hi,

maybe this can help. This script points a sprite to the mouse poiner.
when green flag clicked
forever
if <mouse down?> then
set [X v] to ((x position) - (mouse x))
set [Y v] to ((y position) - (mouse y))
end
if <(X) > [0]> then
set [dir v] to ((-90) - ([atan v] of ((Y) / (X)))
else
set [dir v] to ((90) - ([atan v] of ((Y) / (X)))
end
point in direction (dir)
move (5) steps
end
ChocolateTeapotNot
New to Scratch
100+ posts

Pointing in direction

See this using the above equation.

My drmcw account has viewed too many forum topics so cannot view anymore! This account however says it all!

Powered by DjangoBB