Destroys the specified instance. Calling the function with no arguments will destroy the instance that is currently in scope and running the code, but you can target a specific instance if you provide its ID, or you can target all instances of a particular object by using an object_index.
Argument | Type | Description |
---|---|---|
ID | :real | The instance ID or object_index to destroy (optional, default is the calling instance) |
Example, called from article1_update.gml:
// destroys articles outside of bottom room border:
if (y > room_height + 100) {
instance_destroy();
}
Example, called from update.gml:
// creates and then destroys an instance of article object:
var my_article = instance_create( x, y, "article1" );
// ...
instance_destroy( my_article );