Delete Instance
In GDevelop, you can delete instances of objects during the runtime of your game. Deleting an instance removes it from the scene, allowing you to manage the presence or absence of objects dynamically.
To delete an instance of an object, you need to use the "Delete" action. This action can be triggered by various conditions, such as a key press, a collision, or a timer reaching a certain value.
Here's how you can delete an instance using the "Delete" action:
Open the Events Editor by clicking on the "Events" tab at the top of the screen.
Create a new event or choose an existing event to add the "Delete" action to.
Select the object that you want to delete an instance of from the object list on the left side of the Events Editor.
Right-click on the object and choose "Add an action" from the context menu.
In the action window that appears, expand the "Object" category.
Select the "Delete" action from the list of available actions.
Configure the action parameters, such as selecting the instance you want to delete or specifying conditions for the deletion.
Save your changes and run the game to see the effect of the "Delete" action.
Remember that deleting an instance permanently removes it from the scene, so make sure to use this action carefully and in the appropriate context.
Be cautious when using the "Delete" action, as it can affect the behavior and logic of your game. Make sure to test and verify the results after deleting.
By using the "Delete" action effectively, you can manage object instances dynamically, allowing for more interactive and engaging gameplay experiences in your GDevelop projects.