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: 35
Reputation: 509

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
71
S
19
G
181
Posts: 3,485
Reputation: 103,689

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
58
S
23
G
22
Posts: 890
Reputation: 16,790

Post » Fri Feb 06, 2015 11:15 pm

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

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
32
S
10
G
1
Posts: 14
Reputation: 2,437

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
32
S
8
G
2
Posts: 100
Reputation: 2,610


Return to How do I....?

Who is online

Users browsing this forum: AllanR, rayray, RetroSpock, Turaco and 10 guests