• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Adaptive Rotation(Animation)?

H

Hay

Guest
Hey, I am new to the software, using gm2, and I am working on a "press space dodging game" all the mechanics are pressing space. My question is, when I press space and it goes right, I want it to either play a sprite animation or rotate a static one to the right side, BUT if the animation or rotation is not yet finished and press right again, I need it to smoothly rotate back to the other side.
 

Joe Ellis

Member
angle_difference is quite useful, cus it gives you the direction, as in it returns the difference as a negative or positive number so that if you add the difference on to angle1, it'll become the same as angle2,
so if you get the difference between the object's current angle, and the angle you want it to move to,
then divide this difference by the number of frames you want it to take to move to the new angle, you can add this onto the object's angle one frame at a time, and it'll end up at the desired angle within n frames
 
Top