How do I Auto-Reload Ammo

Get help using Construct 2

Post » Sat Apr 12, 2014 8:44 pm

I've been smacking my head against a brick wall over this. I feel like it is a Beginner's Question.

I have a 2 player top-down arena shooter type of game. I want to limit the amount of shots a player can shoot, force them to wait, and then give them 4 shots again.

I can upload my .CAPX if needed but my main issue is this:

Global Variable: p1ammo = 4

as long as p1ammo > 0 than bullets can be shot.

every time a bullet is created subtract 1 from p1ammo

if p1ammo is 0 or lower, stop the player from being able to shoot for 5 seconds and then set p1ammo to 4.

-------------
.CAPXI can't seem to get the upload attachment to function
[ I can't upload nor can I post a cloud link ]
B
7
S
2
Posts: 18
Reputation: 555

Post » Sat Apr 12, 2014 8:59 pm

you need 2 variables for this, ammo and cooldown.

ammo starts at 4
cooldown starts at 5

every time you shot, substract 1 from ammo
when ammo = 0; every 60*dt substract 1 from cooldown.
when cooldown = 0, set ammo to 4 and cooldown to 5.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sat Apr 12, 2014 9:48 pm

aaaaaaaand fixed.

thank you!
B
7
S
2
Posts: 18
Reputation: 555


Return to How do I....?

Who is online

Users browsing this forum: ratboy3 and 34 guests