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

Jump Animation Not Working with UP key only

A

AlexsGame

Guest
I ran into a problem regarding my jumping animation, and I can't seem to figure out what is wrong or how to fix it.

All the other animations I have work great, and the Jumping animations also works great..... however, the jumping animation only plays when I jump while holding left or right

When I jump straight up by just pressing "UP", my jumping animation is stuck on frame 1, however if I press "UP+Right" or "Up+Left" the animation plays perfect.

If I jump straight up, then press right or left while still in the air, the animation plays through until I let go, then it snaps back to frame 1.

Can't seem to figure it out, tried re-coding my jumping/gravity code, but still it gets stuck on frame 1.

Here is the code - object32 being the floor
Code:
if !place_meeting(x, y+1, object32)
        {
            sprite_index = spr_JumpMain;
            image_speed = 1;
            vspeed_ += gravity_;   
        } else {
            if keyboard_check_pressed(vk_up)
            {
                vspeed_ = -15;
            }   
        }
        
        if place_meeting(x, y+vspeed_, object32)
        {
            while !place_meeting(x, y+sign(vspeed_), object32) {
                y += sign(vspeed_);
            }
            vspeed_ = 0;
        }
        y += vspeed_;
The jumping works great, and I have sprite_index set for when the player is not touch the floor, jumping, but it only plays the animation when I move left or right while jumping.....

If some can help me out, I'd really appreciate it, Thanks.
 
Aa far as I can tell, the problem isn't in that part of the code. You mat have to post some more code, or look in other places where you might be setting the image_index
 
A

AlexsGame

Guest
Aa far as I can tell, the problem isn't in that part of the code. You mat have to post some more code, or look in other places where you might be setting the image_index
I check my running code and I have each set with sprite_index and they are working, I think it might have to do with my left right being pressed at the same time and its messing with my code.... hmm
 
P

Pyxus

Guest
I check my running code and I have each set with sprite_index and they are working, I think it might have to do with my left right being pressed at the same time and its messing with my code.... hmm
Mind posting the code for your movement input?
 
Top