Ammo Clip and Ammo Count variables?

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi guys,

    I spent about an hour or so trying to get these to work nicely together, and am still getting a slight glitch.

    I have AmmoClip - starts at 5, if >0 bullet is spawned and AmmoClip-1. Works well.

    I have AmmoRemain - starts at 15.

    If user pressses R key, if AmmoRemain >=5 difference between 5 and AmmoClip is subtracted from AmmoRemain and added to AmmoClip. Works well. Eg. if I have 2 in clip and press R it checks that there is at least 3 in AmmoRemain.

    Now the glitch. I have if AmmoRemain <5 and >0, Set AmmoClip to AmmoClip + AmmoRemain. So if I have 1 in clip and only 3 in AmmoRemain the first scenario is not met as I would need 4 in Remain. So it adds 1+3, gives me 4 in AmmoClip and I set AmmoRemain to 0.

    Now the glitch. I have sprites on the screen that when you right click on them you gain +3 to AmmoRemain. However the glitch I spotted was I had 0 in clip and 0 in remain. Clicked on one box, got 3 in remain which when R was pressed added 3 to clip and made remain 0. But when I clicked on the next box for a split second it went 6 in clip and 0 in remain, but then corrected to be 5 in clip and 1 in remain.

    Am I doing somthing wrong? This is my first real plunge into the program so any feedback is appreciated.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Couldn't help you without seeing how you have your events set up.

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