Shooting Delay

0 favourites
  • 8 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hi.. i am having problems with creating wait time..before another cannon ball can be shot.. I have set my firing cannon balls on spacebar pressed..and i have set a wait time..and have also set an instance variable..on the player cannon balls....

    so here whats my events look like

    +keyboard On space pressed - wait 1 sec

    +player cannon ball = 0    - Spawn a player cannonball

                               - Set cannon to 1

    +playercannon cannon= 1    - wait 2 seconds

                               - Set cannon to 0

    so basically what i want to do is fire the next cannon ball after 2 seconds from the previous cannonball was fired was fired...above events helps to create a delay..but if i keep tapping space continously..it fires the cannonballs without any delays..

    here's a capx.

    dl.dropbox.com/u/67865856/prototype_Avichal_2.1.capx

  • I don't know if there's a more elegant way, but here's how I do it:

    Player instance variable : RPM_Count (0)

    Player instance variable : RPM (eg 480)

    System > Every tick >

    Mouse > Left button is down > add RPM * dt to RPM_Count

          > RPM_Count >= 60 > Fire bullet event and Set RPM_Count to 0

    Mouse > Left button released > Set RPM_Count to RPM (so that the gun is ready to fire immediately - may want to not include this for a cannon)

    Using an RPM of 480 results in a perfect 480 rounds per minute or 8 rounds a second regardless of FPS. If that's not clear let me know.

  • I don't know if there's a more elegant way, but here's how I do it:

    Player instance variable : RPM_Count (0)

    Player instance variable : RPM (eg 480)

    > System > Every tick >

    > Mouse > Left button is down > add RPM * dt to RPM_Count

          > RPM_Count >= 60 > Fire bullet event and Set RPM_Count to 0

    Mouse > Left button released > Set RPM_Count to RPM (so that the gun is ready to fire immediately - may want to not include this for a cannon)

    Using an RPM of 480 results in a perfect 480 rounds per minute or 8 rounds a second regardless of FPS. If that's not clear let me know.

    i tired doing exactly what you said.. it didn't work..may be i am doing something wrong..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a quick and easy way to do fire cooldowns:

    CooldownMAX.capx (r98)

  • thanks this looks great.. i some how managed to get it fixed on my own.

    here's how i did it :)

    dl.dropbox.com/u/67865856/CooldownMAX.capx

  • Thanks that helped me a lot!

  • Actually if you can help, (I know its been 3 years) I'm trying to add this to all my guns in the game. I've been using Nimtrix's idea but will only work for one gun. Barc0d3guy's way doesn't work because I need it to be a global variable so I can increase the total speed for it to take to shoot. Is there a way to do this for multiple guns?

  • The .capx files don't work any more

    Can you put what you did into text please?

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