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: 34
Reputation: 507

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
166
Posts: 3,425
Reputation: 96,066

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
55
S
22
G
22
Posts: 881
Reputation: 16,595

Post » Fri Feb 06, 2015 11:15 pm

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

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
31
S
7
G
2
Posts: 100
Reputation: 2,485


Return to How do I....?

Who is online

Users browsing this forum: ling200916, ridhoemgl and 8 guests