• 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!

Legacy GM Help with sprite animation??

F

Fabrice

Guest
Hi Gamemakers,
I have an animation of 13 sub-images and I want it when I start walking show the first two sub-images and then follow the rest of the animation without repeating the first two sub -images I do not know if they understand me
(postdata as in megaman x3) (postdata 2 sorry my bad english)


spr_Viral_Run_strip12.png
 

Neptune

Member
Creating alarms in your code is what you need. Here is an example of a simple alarm:

CREATE EVENT
Code:
timer = 0;
timer_end = 15;
STEP EVENT
Code:
if (timer < timer_end)
{
   timer += 1;
}
else
{
   timer = 0;
   //DO STUFF
}
That is a good format for having things happen every 15 'steps' or every 0.25 seconds with room_speed set to 60.
From there you could put this format inside of conditionals like "if running", and increment your sprite's image index etc.

It will probably take some trial and error to get it set up the way you want it, but feel free to post your code as you go, if you get stuck.
Good luck!
 

kburkhart84

Firehammer Games
Another option is to use the animation end event. You want 2 separate sprites, one with the 2 frames, and the other with the rest of them that you want repeating. In that event, you would set the new sprite. Of course, since that would happen any time the sprite frames ended, you need to check if the sprite is the exact one you need. So in that event, use an if statement to confirm if the sprite is the "preparation" one, and if it is, change it to the one you want to loop. If you have a few similar sprites on the same object doing the same thing, it will work fine if you have multiple if statements and use the same animation end event.
 
Top