How do I respawn, duplicate, and kill multiple of one enemy?

I want to have multiple enemies of the same sprite / object, but when I kill one it kills them all. Is there any way i can only kill one without making multiple of the same object?

Yes, a mechanioc of GDevelop called object selection can help you. It’s very easy, only the object that meet the condition will get the action executed on him.
For example, if you have an “Object variable hp = 0” condition with a “Delete object” action in one event, only the instamces of the object that have it’s variable hp = 0 will get deleted.

As other example here’s the UI I am currently working on:


All buttons are the same object but don’t have the same actions/effect, because I set for every button an “ID” variable:

Then, I only need one extra condition to differentiate them and change their effect:
image

5 Likes

Thank you so much! I had no idea this was a thing. Bet I can save a LOT of time with this!

2 Likes

This one saved me a lot, I ignored that this was possible. Thank you so much.

1 Like