Platform : Simulate jump just isn't right

0 favourites
  • 4 posts
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • Hey there,

    When I simulate the jump control from the platform behaviour, it won't act like the actual control. In this very case, the player can jump pressing the keyboard's up arrow (which is the default platform behaviour's control), or alternatively touch/click an on-screen upward arrow (which will simulate the platform behaviour's control). The issue is you can control the jump's height with the default control but not with the simulated control. I'm attaching a .capx to show what happens.

    Is there any way to fix this without having to alter the Y vector or jump strenght or gravity or whatever other value only when using the simulated control? It'd be really neat to just have a working simulated control that does exactly the same as the default control.

    Thanks in advance if someone can help me with this one.

  • Hey Kan,

    I think there are two problems you might be encountering.

    1: (see line 2)

    "On touched" is a triggered condition, not a per-tick condition, so when it is triggered, it will only simulate the up movement for a single tick, and then stop until it is triggered again by a new touch. By contrast, holding down the up arrow key on the keyboard, is the equivalent of executing the "simulate up movement" action every tick (every frame), for as long as the key is held. (You can recognize triggered conditions, by the green arrow icon that always appears next to them.)

    2: (see line 5)

    For the condition, when the player is "jumping", AND while Keyboard Up arrow is NOT pressed, the corresponding action is cutting your upward speed in half every tick (60 times a second).

    This isn't an issue when using the keyboard controls, because you actually are holding down the up arrow key when jumping.

    However, it *is* an issue when "touching" the up button in the game, because you are now not holding down the keyboard up arrow key, so your upward speed is getting cut in half every tick because of that event.

    Try the following...

    Line 2:

    Change the condition

    "? On touched arrow_up"

    to

    "Is touching arrow_up"

    Line 5:

    Find the event containing the condition shown below, and disable that entire event, (not just the condition):

    "? Up arrow is down" condition (line 5).

    That should make the jumps identical, but now you can't make a small jump.

    To fix this, enable the line 5 event again, and split the "? Up arrow is down" condition into its own subevent (under the "Platform is jumping" event), and move the action onto this new sub event.

    Finally, to the new subevent, add the condition "Is touching arrow_up", and then invert that condition, to create "? Is touching arrow_up".

    Now your upward speed will only be cut short if, you're not holding the up key, AND you're not holding the on-screen up button.

    Hope that does what you're looking for.

  • Thank you very much Fisholith. I admit I was a bit silly, I hadn't even properly checked my own event altering the Y vector. I had tried all variations of line 2 (in touch, touching, on touch, on touch start, etc.), but it was mainly line 5 that was ruining it all.

    Now everything's working fine! Let's see if I can make the other on-screen arrows work too.

    Thanks again!

    (And I still don't know how to close a topic)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem, glad I could help.

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