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:
Thank you so much! I had no idea this was a thing. Bet I can save a LOT of time with this!
This one saved me a lot, I ignored that this was possible. Thank you so much.
I know this is alredy solved, but what if I have like 100 sprites and want to delete 1, how could I delete one without putting an Id variables in each?
It’s best to start a new post instead of adding to an old post. You can always reference the older post in your new post.
Object/instance picking is a core concept. Maybe I’m misunderstanding the question.
To delete 1 instance of an object it needs to be picked otherwise any action will affect every object.
Almost any condition will pick objects and reduce the pick list.
The common ones are collision and mouse events.
Condition
Bullet is in collision with enemy
Actions
Delete bullet
Delete enemy
If your question is more complex. It would be best to start a new post.
I don’t remember how, but in the past I figured out how to delete one instance of the obj without deleting the others, but I lost the game files, though I’ll use “id” this time (LOL)
I was just wondering what if I need more objects to be deleted, since more phases and enemies will be added.
I don’t use the mouse as condition in this current game, (it’ll be a pc/mobile game)
I’m trying to use the collision condition like I used before. (but the ID sollution will be used, no need to reply)
about your advice on creating a new post instead. I didn’t know, but Thanks for your time!