How do I destroy latest object instead of all objects

Get help using Construct 2

Post » Fri Feb 13, 2015 10:11 am

So right now I am making an ammo and reload system, while making it I saw there was a problem with the bullets my player was firing. When "playerAmmo is equal to and less than 0" then "Destroy the object, Bullet". This is in order to make sure that when you keep clicking without ammo the Bullets gets destroyed immediatly. Now my problem is that when you have fired multiple bullets and they are visible on screen the playerAmmo hits 0 and destroys all bullets instead of the latest one. Anyone who would know how I could destroy the latest bullet instead of all bullets at the same time? Thank you!
B
3
Posts: 6
Reputation: 187

Post » Fri Feb 13, 2015 10:34 am

A much more sensible way to do this is to only spawn bullets if the variable is >0
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Fri Feb 13, 2015 10:45 am

Somebody wrote:A much more sensible way to do this is to only spawn bullets if the variable is >0


I feel stupid. I could do all this and somehow make it work, with a minor problem. Though the answer was so simple. Thank you! :)
B
3
Posts: 6
Reputation: 187

Post » Fri Feb 13, 2015 2:22 pm

You can also try this custom behavior : behavior-jj-weapon_t64676 (but if you intend to learn how to use construct, that's a better idea to do it all by yourself I guess)
B
12
S
7
G
7
Posts: 450
Reputation: 4,276


Return to How do I....?

Who is online

Users browsing this forum: zsoldiers and 8 guests