How do I fix my jumping bug.

  • Hey all,

    I was making a game with Arrow key movement, but this didn't work out when I figured the WASD keys + mouse would allow more keys to be reached and more comfortable to play.

    So, when I tried to change every Arrow up into a W, arrow down to S, etc, I noticed that for some reason, when I jump, my vector X goes to 0 instead of the maximum speed it should have.

    Also, when I jump, it goes up, but won't go diagonally like you would in real life, it just jumps up to the air without moving on the X axis.

    Weird thing is, it worked with the arrow keys, and I cannot seem to fix it. There isn't even an event that makes the speed, or vector X to 0.

    Anyone would like to send me a PM who I can reply on and send the capx? It contains original content and I wouldn't want to upload it publicly.

    i.imgur.com/NVRLhM5.png

    If capx is required, i'd be glad to send it to a person with a decent reputation, receiving it is agreeing to never share screenshots/art and/or anything that is included in the project besides the sounds that have been imported. Those are public domain.

    Thank you in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For platform movements like running/jumping you need to replace "Keyboard On <key> pressed" events with "Keyboard Key Is down".

    "On" events are triggered only once. "Is" events are triggered multiple times while the key is down.

    (Same goes for Mouse and Touch events)

    Use "On" events for actions where you don't need repetitions - for example to open a chest, press a button etc.

    For the same reason you should not have actions like "Set animation (play from beginning)" in "Is" events, because animation will be stuck on frame 0 while the key is pressed. (see event 11 on your screenshot)

    You can use "On" event to start animation, then "Is" event to simulate platform movement.

  • Ah great, thanks a lot im going to try it now!!

  • For platform movements like running/jumping you need to replace "Keyboard On <key> pressed" events with "Keyboard Key Is down".

    "On" events are triggered only once. "Is" events are triggered multiple times while the key is down.

    (Same goes for Mouse and Touch events)

    Use "On" events for actions where you don't need repetitions - for example to open a chest, press a button etc.

    For the same reason you should not have actions like "Set animation (play from beginning)" in "Is" events, because animation will be stuck on frame 0 while the key is pressed. (see event 11 on your screenshot)

    You can use "On" event to start animation, then "Is" event to simulate platform movement.

    Thank you! It works perfect now!

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