0 Favourites

How do I make a delay between bullets (plataform game)

  • Hi guys,

    i'm wondering how to make a delay between each bullet shot, i'm building a "megaman like" game and i want my "archer" to shot an arrow, then wait something like 0.5 seconds and then shot another. See what i mean?

    (I attached an image for you people to see the arrows)

    the player objetct is "Archer" and the arrow is called "SingleArrow"

  • You need to add instance variable to the player : boolean and make it true

    keyboard on clicked or mouse

    Boolean is true ------------- shoot

    ------------- set boolean to false

    ------------- wait 0.5 seconds

    ------------- set boolean to true

    You can check the shooter rain demo inside C2, The player use delay with his gun.

  • You need to add instance variable to the player : boolean and make it true

    keyboard on clicked or mouse

    Boolean is true ------------- shoot

    ------------- set boolean to false

    ------------- wait 0.5 seconds

    ------------- set boolean to true

    You can check the shooter rain demo inside C2, The player use delay with his gun.

    Thanks A0Nasser

    It works like a charm

  • You can make the "Archer" in the same Keyboard event, you don't have to use subevent.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You could also use the "Every X Seconds" event together with the On Space Bar Pressed event, it will work the same way.

    You can also use the "On Key Pressed" event, if you want the archer to shoot an arrow every time you press the spacebar, but don't want him to keep shooting while the bar is pressed.

  • You could also use the "Every X Seconds" event together with the On Space Bar Pressed event, it will work the same way.

    You can also use the "On Key Pressed" event, if you want the archer to shoot an arrow every time you press the spacebar, but don't want him to keep shooting while the bar is pressed.

    "Every X Seconds" doesn't work as well because the seconds are independent of any key press.

    For instance, if it's every 5 seconds, and you press shoot at the 4th second, you can shoot once then, and after a second, you can shoot again.

  • > You could also use the "Every X Seconds" event together with the On Space Bar Pressed event, it will work the same way.

    >

    > You can also use the "On Key Pressed" event, if you want the archer to shoot an arrow every time you press the spacebar, but don't want him to keep shooting while the bar is pressed.

    >

    "Every X Seconds" doesn't work as well because the seconds are independent of any key press.

    For instance, if it's every 5 seconds, and you press shoot at the 4th second, you can shoot once then, and after a second, you can shoot again.

    Even when it's a sub condition? I have been using this without problems, but my delay is a lot shorter than that. Didn't know, I'll fix that on my game, thanks!

  • The Timer behaviour is the most versatile mechanism to use.

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