Delay initiation of Keyboard event on keypress

Get help using Construct 2

Post » Fri Jan 11, 2013 8:10 am

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? :)
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Fri Jan 11, 2013 9:33 am

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
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Fri Jan 11, 2013 10:28 am

@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?
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest