How do I add a delay for X condition?

Just started using Construct 2? Post your questions here

Post » Tue Jan 19, 2016 4:39 pm

Im making a fighting game and I want a small delay for the action to happen once the conditions are met, how do I make it? If the event is

Condition: A is pressed Action: Set animation to ''Attack_Player'', Create object ''Damage''

I want this actions to be done once the conditions are met for half a second, so It wont happen if you tap and you have a small response window
B
8
S
1
Posts: 37
Reputation: 424

Post » Tue Jan 19, 2016 5:39 pm

Hi,
Just to be clear, you want the action (Set animation to ''Attack_Player'', Create object ''Damage'') to be triggered only if the "A" key has been pressed for 0.5 second?
B
16
S
9
G
5
Posts: 74
Reputation: 4,120

Post » Tue Jan 19, 2016 5:47 pm

exactly, I have many ideas to make this effect but I would like to know about one that uses the fewest events
B
8
S
1
Posts: 37
Reputation: 424

Post » Tue Jan 19, 2016 6:18 pm

Have you tried the Timer behavior? Add the behavior to your player sprite object:

Keyboard: On "A" pressed => Sprite: Start Timer "timer" for 0.5 seconds (Once)
Keyboard: On "A" released => Sprite: Stop Time "timer"
Sprite: On Timer "timer" => Set animation to ''Attack_Player'', Create object ''Damage''
B
16
S
9
G
5
Posts: 74
Reputation: 4,120

Post » Tue Jan 19, 2016 6:30 pm

Do I have to add the timer behavior?
B
8
S
1
Posts: 37
Reputation: 424

Post » Tue Jan 19, 2016 6:39 pm

Go to system, and than to wait (x) seconds
B
7
Posts: 16
Reputation: 313

Post » Tue Jan 19, 2016 6:44 pm

Yes, it is in General section of behaviors.
B
16
S
9
G
5
Posts: 74
Reputation: 4,120

Post » Tue Jan 19, 2016 6:50 pm

thanks, it indeed worked, another question, I have problems with platform movement, Im using a non solid sprite pinned to a solid invisible rectangle with the platform movement behaviour, for some reason the animation sprite shakes while moving, I cant find a solution in the manual, It only shakes in certain areas, the surface is also a straight rectangle
B
8
S
1
Posts: 37
Reputation: 424

Post » Tue Jan 19, 2016 7:52 pm

There are many reasons why that might occur. My suggestion is to start another post and include a capx so that others will have a better insight of what's happening.
B
16
S
9
G
5
Posts: 74
Reputation: 4,120


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests