Fire rate of bullet help

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • My character shoots when I tap CTRL, problem is he shoots every time CTRL is pressed, how do I give the bullet a fire rate? so the player can tap CTRL how much he wants but will only shoot one bullet every 1 seconds.

  • see there is 2 way to do that :

    1) event:condition1:keyboard : ctrl pressed

            condition2:every x second

            action:player:spawn bullet

    but this is kinda buggy so i will say try to use the second one its 100% working perfect ^^

    2)event:condition1: keyboard: ctrl pressed

            condition2: system: compare two values -> bullet.count <= 0

            action:player:spawn bullet

    in this one you will do bullet when there is no bullet in the screen so you should destroy the first bullet if you want to shoot again :P so add this to actions

            action:system:wait -> 2seconds

            action:bullet:destroy

  • zsangerous

    I prefer the 1st one, thanks for the help it works now :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • your welcome :P an advice try to understand the events ^^

    simple way to understand them :

    if (condition1+ condition2+...+ subevents if it has) will do (actions)

  • I had the same problem, I went away and created a created a Global variable, "true"/"false". What I did from there, was when the player hit the fire button (In my case it was the mouse) it would also look to see what value the Global var was, if it was true, it would shoot, if it was false, it wouldn't. Then after I shoot the bullet, I set the Global var to false, and then did a System>Wait 1 Second and set the var to true. This is also how you would go about doing an automatic. Cheers mate.

  • Just out of curiosity, how would you do an automatic shooting? for example I hold CTRL and it will shoot auto until I let go of the button?

  • TehChikenHater good idea but why you used it :P hehehe i think there is more ways to do this also but just use the simplest :) so in the future you can edit them when you want ,lets say the player want to shoot 2 shoots then he must wait? what will you do XD?

    by the way, i like when i see someone try to do something even if its wrong :)

    keep going and good luck :)

  • My way works. It's in my current game Alien Rampage! find me on Kongregate, then play the game. Once you get 500 cash, press 1; which will buy the automatic, then fire and it won't spam the screen.

  • (Name wrong?)

    You would you the Mouse>Button Is Down event.

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