How do I Auto-Reload Ammo

0 favourites
  • 3 posts
From the Asset Store
A sound pack containing 132 laser gun sound effects, including mono and stereo versions of audio files.
  • 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 ]

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • aaaaaaaand fixed.

    thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)