[Solved] How do i make multiple clones of object and only delete a certain one

I would like to make multiple clones of sprite and delete only a certain one at a time
I don’t want to create each sprite by hand it will take years
thank you

It depends on how you want to identify which sprite to delete. Is it a spite closest to a point, one nearest to another object, the order the sprites are created, a sprite selected at random or something else? This will determine how you set up the sprites.

Use the shadow clones extension each clone is identified with a variable easy to compare in a loop the if match then delete

Ha, I hadn’t considered OP might be after this. I was thinking of a load of platforms, and that some get deleted.

I don’t understand the only extension I see is animate shadow clones and it doesn’t help me,
can you please maybe upload a code snippet

i want the sprite that the player is in collision with

Then just use the collision condition. This :

image

Will select the player sprite and only the box sprites that it collides with. Any references to the box object in this event and it’s sub events will be to just the boxes that collided

does this work if I have multiple objects from one sprite?

will it hid all of them or one that is in collision?

Try if for yourself. It’s the best way to learn. Try something, and if it fails, work out why and fix it.


But only for the event and it’s sub events.

I tried it didn’t work

maybe I didn’t explain myself, i am trying to make multiple objects from one sprite so when i tried yours it just deleted all the placed objects from that one sprite can someone please help

but thank you @MrMen for the suggestion
if you have more ideas please tell me

Can you provide a screen shot of your events? It sounds like you may have something not quite right.

Those events do not match what you described.

Hiding an object is not the same as deleting it. When you hide an object, it is still present in the scene, and interacts with other objects - for example it still collides with other objects. A hidden object is just invisible and not shown. Think of it like the invisibility cloak in Harry Potter - he can’t be seen, but can still be felt and interact with everything around him.


So when you say GDevelop deleted all the sprites, I’m assuming you are referring to the token objects. If this is correct, then yes, what you’ve done is not quite right.

In the first event, the condition selects the token that is in collision with a machine object. But that token is only selected for the first event. Any tokens referenced in events 2 & 3 are all the token objects in the scene.

In that last event, when the animation of time_bar is finished, you are not specifying which token to hide. The token selected in the first event does not carry through to other events at the same level as the first event. So the third event works with all tokens, and so will hide all of them. You need to use conditions to specify which token object to hide.


The solution :

From your events, it looks like just adding the condition machine is in collision with token in the third event will be enough to get it working the way you are after.

1 Like

thank you so so much

i been trying to find a solution