Remove a single copy of a sprite but not all clones?

Hello friends,

I am attempting to make a platform. I have a vertical wall sprite. I have cloned this several times on the scene. I have a ‘key’ sprite over to the right side, behind the wall… If the player touches ‘Key’ sprite =delete Key and Wall (to the left of the key), so the player can get though.

I’m doing my best to move away from construct2. In construct2, they have UID’s for every object.
Is this just a case of creating multiple objects (i.e. wall#1, wall#2) or can this be achieved like construct?

Screenshot from 2021-11-21 12-37-09

Hi @robertofreemano. There isn’t any UID’s for every object in GDevelop but you can make one yourself. You can have instance variables. Make one instance variable
image
Name it ID
image
And give each of them different IDs then go to the events tab then
If ID of Object = this Then
Do that.

If you didn’t understand what I said then I can describe it again and more clearly.

Thanks Mixen,

I’ve just watched a quick YT video… but I don’t feel I got it.


I tried Wall1.ID(1) but still no joy
and Wall1.Variable(ID)

The condition must be:

  • Player collision with key delete key
    • Wall1.Variable(ID) = 1 delete Wall1

You need to use a condition to check the value of the variable, and then delete it if it is true.

I hope it helps

Eureeka!!!

Thank you oscuridad666. I was going out of my mind with this.

Obviously I was trying
Player is in collision with Key Delete Key
Delete wall1.ID(1)

You’ve helped me get passed this BLOCK.

THANK YOU SO MUCH!!!

1 Like