How do I make it so a bullet can only be fired every 3 sec?

Get help using Construct 2

Post » Fri Feb 06, 2015 9:01 pm

I need help to make a bullet to only be fired every 3 seconds. It's the player who fires the bullet when I press "W". The problem is that i can spray as many bullets as possible. Thanks in advance. -Klungland
B
7
S
1
Posts: 24
Reputation: 487

Post » Fri Feb 06, 2015 9:08 pm

The common trick is to put your keyboard code in a Group and then disable the group and start a timer to enable the group again in 3 seconds.
ImageImageImage
B
70
S
19
G
139
Posts: 3,317
Reputation: 82,216

Post » Fri Feb 06, 2015 9:15 pm

Here's one way you could do it.
You do not have the required permissions to view the files attached to this post.
B
51
S
19
G
19
Posts: 859
Reputation: 14,651

Post » Fri Feb 06, 2015 11:15 pm

Thanks for the help, both of you :)
B
7
S
1
Posts: 24
Reputation: 487

Post » Sat Feb 07, 2015 12:49 am

Even simpler :
You do not have the required permissions to view the files attached to this post.
B
30
S
9
G
1
Posts: 14
Reputation: 2,287

Post » Sat Feb 07, 2015 1:18 am

@Gunter
The only problem with your code is that will not spawn a bullet every time the W key is pressed unless its been 3 seconds since the last bullet spawned. So for instance the first time you shoot you'll have to wait 3 seconds to see anything.

@Klungland
You could however combined W pressed and W down to achieve what you want:
You do not have the required permissions to view the files attached to this post.
B
30
S
7
G
2
Posts: 100
Reputation: 2,460


Return to How do I....?

Who is online

Users browsing this forum: wizdigitech and 10 guests