Delay initiation of Keyboard event on keypress

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • I have a jump animation I want to employ, but the actual jumping action takes place before the animation is ready for it. The animation has my character crouching down for a few frames before he is ready to leap into the air. However, upon keypress, he's already in the air. I found the System/Time/Wait event, but that only delayed when the animation started...my character got launched then decided, "Oh, wait, I'm suppose to jump now." Heh, any help, please? :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could set up custom controls, instead of relying on the built-in platformer controls. You'll still use the behavior, though. Disable default controls under the object's properties.

    Your events will go something like this:

    1) On key press up -> start jumping animation

    2) On jumping animation frame = 3 (or whatever) -> simulate platform control jump

  • GeometriX

    Thank you. Actually, I managed to figure something very similar out (if not identical in run time/execution). This is what I have so far:

    KEYBOARD | W is down

    --> Player | Set animation to "IdleToJump" (play from beginning

    --> System | Wait 0.15 seconds

    --> PlayerBox | Simulate Platform pressing Jump

    -------------------------------------------------------------------

    PlayerBox | Platform is Jumping

    --> Player | Set animation to frame 6 [of the "IdleToJump" animation]

    --> System | Wait 0.15 seconds

    -------------------------------------------------------------------

    PlayerBox | Platform On landed

    --> System | Wait 0.15 seconds

    --> Player | Set animation to "Idle" (play from beginning)

    Even disabling System | Wait 0.15 seconds under Platform On landed

    OKAY! That's what I got as far as all of that goes. It seems to work well for the MOST part.

    But a new "problem" arose. I want to be able to hold the W button is down, I want my Player to jump repeatedly until I let off the W. But in doing this, instead of staying on frame 6 of my jumping animation, it recycles between frames every 0.15 seconds. I wanted it to end on frame 6 until the collision with a platform sprite.

    If I set it to KEYBOARD | W is pressed, then everything runs as it SHOULD, ending on frame 6 of the jump animation, but holding the W down won't make the Player continually jump until I let off the key. I'm not sure if I need to group conditions together or have separate conditions with their own events to respond with...

    It occurs to me that the endless jumping may not be viable in a game (this is just me learning the works and trying to figure stuff out), but I'd like to understand what I am perhaps overlooking or could try otherwise. ... Does that all make sense?

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