How do I add a delay for X condition?

  • 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

  • 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?

  • exactly, I have many ideas to make this effect but I would like to know about one that uses the fewest events

  • 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''

  • Do I have to add the timer behavior?

  • Go to system, and than to wait (x) seconds

  • Yes, it is in General section of behaviors.

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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