How do I destroy only one copy of the object

  • 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

  • Try Construct 3

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

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

  • 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

  • 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

  • Add the condition

    bullet - pick nearest/furthest

    so it's a condition of the sprite, not a system condition.

  • thank you very much .. it works

    I appreciate that

  • 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

  • thank you .. I appreciate that

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