How do I destroy only one copy of the object

Get help using Construct 2

Post » Sun May 03, 2015 6:54 pm

hi everyone ...

i copied an object to 5 copies ... the object is a bullet
so i have 5 bullets at the bottom of the layout
so i want to destroy one bullet every time i shoot

any help please ?

thanks
B
3
Posts: 5
Reputation: 185

Post » Sun May 03, 2015 9:42 pm

I can only assume you are doing this as a way to limit the number of bullets that can be shot?
Or do you have 5 bullet "icons" at bottom you are wanting to count down as player shoots?

If its the first one then use a variable Shots=5 and subtract 1 from it each time the player shoots and conditions out Shots=>0.

If its the second option then use a system picking event starting at the far left (X=0) and pick "furthers instance from X,0" then destroy and repeat each shot.

I would also suggest reading the Manual under "How Events work" and focus on the "Picking" of instances area... makes picking specific instances/copies much more understandable.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Mon May 04, 2015 2:19 pm

Image

i did this but it is gonna destroy one bullet only ... how to destroy the next bullet on the next shoot ?

you said (pick "furthers instance from X,0") i do not know how to do it

thank you
B
3
Posts: 5
Reputation: 185

Post » Mon May 04, 2015 2:26 pm

i added a sub event to the (mouse - on left button clicked ) event
the sub event is (pick overlapping point)
if i started picking from x=0 as you said .... how to pick "furthers instance from X,0"
i do know how to do it
B
3
Posts: 5
Reputation: 185

Post » Mon May 04, 2015 2:34 pm

Add the condition

bullet - pick nearest/furthest

so it's a condition of the sprite, not a system condition.
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

Post » Mon May 04, 2015 2:45 pm

thank you very much .. it works

I appreciate that
B
3
Posts: 5
Reputation: 185

Post » Mon May 04, 2015 3:04 pm

or if you want to destroy the one you created first / last and then go on with the previous, use

your trigger
for each bullet sort by bullet.iid ascending (or descending): destroy bullet; stop loop
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Mon May 04, 2015 3:28 pm

thank you .. I appreciate that
B
3
Posts: 5
Reputation: 185


Return to How do I....?

Who is online

Users browsing this forum: htmlgames and 4 guests