Delayed shooting with one key press

0 favourites
  • 5 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • I'm trying to make an object shoot other objects when the player presses a button, but the shoots should be delayed by 0.1 seconds.

    I tried 'repeat' with 'every 0.1 seconds', but it just shoots once.

    I tried 'repeat' with 'wait', but it just freezes the game after I press the key.

    I tried substituting 'repeat' with a 'for', and it does the same in both scenarios.

    I tried to assign a variable with an 'every 0.1 seconds', but it just shoots once.

    I would post the capx but it's a mess, so if you really need me, I'll try to recreate the problem in a new one (I hope that's not necessary).

    Thanks in advance!

  • So are you:

    • Trying to shoot multiple shots with one press of the button, spaced 0.1 seconds apart,
    • Trying to shoot multiple shots while the button is held down, spaced 0.1 seconds apart, or
    • Trying to shoot one shot, delayed 0.1 seconds after the button is pressed (or released)?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Trying to shoot multiple shots with one press of the button, spaced.

    I have another action that doesn't let me 'shot' more than once per second, so let's say I press the button two seconds in a row, I would want, at these times:

    0.0 shot 1

    0.1 shot 2

    0.2 shot 3

    1.0 shot 1

    1.1 shot 2

    1.2 shot 3

  • + On key pressed

    -> Spawn an object

    -> Wait 0.1 seconds

    -> Spawn an object

    -> Wait 0.1 seconds

    -> Spawn an object

  • My bad, I should have said that the number of shoots could vary and I'm shooting them from different image points, so that's why I was trying to use a loop...

    Anyway, checking for the points worked as Ashley said, so thank you very much!

    Can you explain me why the wait inside the loop freezes the game?

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