Ammo Clip and Ammo Count variables?

Get help using Construct 2

Post » Mon Dec 30, 2013 6:50 am

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.

Thanks!
B
5
S
1
Posts: 44
Reputation: 465

Post » Mon Dec 30, 2013 7:06 am

Couldn't help you without seeing how you have your events set up.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, TELLES0808 and 4 guests