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

FALLING CHARACTER ANIMATION

RODO

Member
Hello guys, it's me here again asking for your help to create something that I have no idea how to start. I will try to be as clear as possible as it is difficult to explain. Well, I'm redoing an old platform game that I made, and I wanted to make the character's animation shape according to the fall, that would be, he would make an animation of how he was falling from a high place or when he started his jump and was almost arriving in floor. How could I do that? (sorry for my bad english, if you don't understand tell me that i will try to be clearer)
 

FoxyOfJungle

Kazan Games
If you check if the jump speed is greater or less than zero, you can increase or decrease the image_index as this changes (and use a clamp not to exceed the desired), so you will perform the jump animation in these conditions.

GML:
if (vsp > 0)
{
    //falling
    sprite_index = spr_player_falling;
    image_index += 1; ...
    clamp...
}
else
{
    //jumping
    sprite_index = spr_player_jumping;
    image_index += 1; ...
    clamp...
}
 

RODO

Member
If you check if the jump speed is greater or less than zero, you can increase or decrease the image_index as this changes (and use a clamp not to exceed the desired), so you will perform the jump animation in these conditions.

GML:
if (vsp > 0)
{
    //falling
    sprite_index = spr_player_falling;
    image_index += 1; ...
    clamp...
}
else
{
    //jumping
    sprite_index = spr_player_jumping;
    image_index += 1; ...
    clamp...
}
Thanks a lot for the help
 

TheouAegis

Member
Relatedly, have a variable like fallHeight set to 0 in the Create event and whenever the instance lands on the ground. Every turn, add your vertical speed to that variable.

When your vertical speed is less than 0, use your jump-up sprite. Otherwise, if fallHeight is less than 0, change to safe fall sprite, else if it is greater than 0, change to big fall sprite.
 
Top