Create an object from a sprite

OK what I want is for my chest to create a healing object I already have the events but when I press the key to open the chest, the chest opens but the object does not appear, I also want the chest to open if the character is close to the, because I press the key and all the chests that I put open

Use the debugger to check if the object is not created or not visible.

ok the object was not created

Then either one of your conditions is not valid,
either there is an error in your create action,
either you have a delete action that runs too quick.

I do not know what the error is, nor do I know how to make the chest not open without being away from it

You’ve asked some pretty specific questions, essentially you need more conditions for the events - think about how to make them GDevelop conditions.
For chest opening, to make the object appear just create it at chest position.
To do that, replace “position -800; 288” by objectName.X() and objectName.Y(). (replace objectName with what your chest name is)
(You can find these functions if you type in blue equation button, definitely search around)
To check if player is close enough, you can add condition to check “distance from object”, or even if player’s sprite colliding with the chest object, before actually opening the chest.
Also you can destroy chest object once it’s opened so the healing item does not appear multiple times.

1 Like

ok I did but I have a little problem, when I open the chest it opens but life appears but it collides with me and makes it not appear I want life to appear above the chest

In that case, we’ll just modify the result of that objectName.Y() function to make it higher. Add subtraction to the Y position, like objectName.Y() - 40 to make it 40 pixel higher than the chest

1 Like

ok but when the chest is opened the object is created but not seen, try the Z order but still not seen.

Then you probably need to put it on a higher layer.