I am recreating galaga and have my sprites traveling down from the top then in a half circle and back up, much like a U shape. My code is just a serious of glides to various points I plotted. I would like to clean up my code and not have to plot points in order to make it perform a circle. I have found equations for a circle but I am not able to make it work for my specific project. Any help would be useful thanks.
Offline
Why not do something like:
when gf clicked
go to start position
forever
point in diretion 180
repeat 100
move 1 steps
end
repeat 180
turn 1 clockwise
move 1 steps
end
repeat 100
move 1 steps
end
glide to start position
Offline
You can use trigonometry to accurately position a sprite on a circle. Use equations like this:
Set angle to 0
Repeat 360
Set sprite X to XC + R*sin(angle)
Set sprite Y to YC + R*cos(angle)
change angle by 1
XC and YC are the center of the circle, R is the radius. You can change the speed that the sprite goes along the circular path by changing how fast the angle changes. Hope that helps
Offline
Thanks, I will try them and see how it works
Offline