0 Favourites

Platformer not jumping because of animation?

  • Hi all,

    I have a problem with my platform game where I have set the W key to jump for my character. I also set an animation to play while the character jumps. The only problem is whenever I click W, the player doesn't always jump but the animation still plays. Sometimes, maybe like 10% of the time, the player will jump and the animation will play but normally it doesn't. I'm guessing it is because I have another animation running (Idle and walking), but not entirely sure. The code is very simple. It's just:

    When W key is down ====>

    Simulate control Jump

    Set animation to "Jumping" (play from beginning)

    Any advice is appreciated

  • Why not use the trigger "On W pressed"?

    not sure why it's not jumping, but I can tell you that animation is being set over and over (every tick) until W is released.

  • Yeah, spacedoubt is basically right. Had the same issue a long time ago. You'll want to set that to "On W Pressed".

  • TabloidA spacedoubt I tried to set it to On W Pressed however then the player doesn't move even though I have Simulate Control. I'm not sure why but On W down worked so I just used that instead

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • well, one is a trigger and one is not. meaning all the actions tied to "on W down" are going to happen waaay more times than they need to.

    If it's not working with on pressed, there's an issue somewhere else..

    I'll take a shot in the dark.. are your sprite's collision boxes changing? or is there any other reason the platform behavior is not registering your sprite as on the ground? (see, if this were changing, say, for example, because your collision boxes are changing with the animation frames, then jump will not work as a trigger.. but having it trigger every tick until it registers as on the ground, would get you a jump)

  • spacedoubt the frames are definitely changing in my character but I set the origin in each frame the same. Sometimes the frames might overlap the ground instead so that might be it. I'll test it out

  • what about the collision box of each frame? is it changing?

  • Oh haha it took me a second to register what you meant by collision box. Yes they are changing but I just corrected it so that the frame size and collision box size is the same in the entire animation. Unfortunately that did not correct my problem. The character still does not move when the W key is Pressed.

  • Here's all my code. It's only 13 blocks of basic controls.

    http://imgur.com/a/GHBO7

  • It seems like the problem could either lie in the "Wait 0.5 seconds", or "When isShooting is equal to 0". A capx would be nice so we could look at the entire project better.

  • I see:

    When the patform is jumping and when there is no shooting gooing on > play jump ..

    I suppose this is kinda always true, while in the air. Resulting in setting the animation to play from the beginning every tick. So, what you see is the beginning over and over again. And that makes you think it does not animate. But it does, it is playing the beginning every tick, as you requested it to do.

    When there is shooting gooing on, the condition is ofcours not true, and the animation will not be set/play.

  • Any resolution? I have the same problem.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)