Active Users18 guests
Rotation tutorialPosted on 2019-03-05 07:41:09
With the help of a fellow user "impo', I was able to complete a difficult problem involving animating a sprite. i didn't want the standard 360 degrees rotation. I wanted it to rotate along the x-axis, similar to the coins animation in Mario games, without i having to make any additional frames.
So i decided to share this in case others may want to the same in their games.
the code is very easy and self-explanatory.
1. in your object, in the Create event, create a variable to handle the rotation speed....eg.....rot = 0;
2.In the Step Event, increase that variable. Depending on the room_speed, you can set it to a number between 0.01 to 1.
3. In the Draw Event, use the "draw_sprite_ext" function and in the case of the rotation, section, place (your variable)] there. for example in the Draw Event of the source I have
draw_sprite_ext(spr_0, 0 ,x,y+z, 1,1,imgrot,c_white,1);
spr_0 being the name of the sprite
imgrot is the name of my variable
CommentsNo comments have been posted, yet. Log in to post comments.