If I wanted to set the angle between two objects gradually, how could I do that?
For example, I want my rocket to turn towards the cursor at a rate of 2 degrees per frame. How could I go about achieving this effect? (rather than the rocket simply pointing to the cursor all the time)
Some sort of function to get the angle between two objects would be handy (if there isn't already one there, I believe sin/cos/tan could possibly be used however I was always bad at trigonometry and the like D: )
Develop games in your browser. Powerful, performant & highly capable.
You do simply like this:
-Create Sprite object
-Create Event "Always"
-Action "Sprite: Rotate 2 Degrees toward (MouseX,MouseY)"
If you want rocket to be slower change Always to Every 0.5s or something like that
Yep, you can use "Rotate towards position" or "Rotate towards another object." As Doppel pointed out there's a "Rotation amount" setting for both of those.
Alternatively, you could do something like:
+Sprite Angle Less than 180
-Sprite: Rotate 2 degrees clockwise
"Set angle" makes the object jump immediately to whatever angle you pick, "Rotate (whatever)" sets the angle gradually.
Thanks for pointing that out, I feel kind of dumb for missing it.
Maybe I should sleep sometime, I hear it's beneficial.