How do I slow down player's firing rate?

Just started using Construct 2? Post your questions here

Post » Thu Apr 21, 2016 2:45 am

So I have a button that allows a player to fire a bullet, however I don't want the player to be able to mash the button and shoot an endless stream of bullets. What can I do to slow fire rate/spawning of a bullet?
B
12
S
2
Posts: 33
Reputation: 714

Post » Thu Apr 21, 2016 5:15 am

I suggest this small tutorial
https://youtu.be/Ki9LnAhBHdU?t=452

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Thu Apr 21, 2016 5:18 am

Create a Global variable and call it "Can_Shoot". Use 0 for false and 1 for true and set it to 1.

Create a dual condition with the following events:

Button Is Pressed > Gun > Set Can_Shoot to 0
Can_Shoot =1 > Spawn Bullet
___________________ >System Wait 0.2
___________________ > Set Can_Shoot to 1


Bullets can only fire when Set Can_Shoot =1 and use System Wait to dictate the amount of time before it can fire again
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Thu Apr 21, 2016 8:04 pm

Thanks! That did the trick!
B
12
S
2
Posts: 33
Reputation: 714


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests