Badges
Games (6)
Mystery Mansion
Mystery Mansion 64bit Linux
DOTR
Amazing Box Puzzles
Unravel
Balloon Pop
Examples (9)
Count Down timer bar
AI mp_potential_step Example
Rotation tutorial
Create a Collapse game tutorial
Drag and Drop
Create a simple Select Level screen
Select Level screen Update
Mithe
Tetris for Enigma
90 guests
Rotation tutorial
Posted on 2019-03-05 07:41:09With 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
Log in to post comments.
No comments have been posted, yet.