Argument Description index The index of the sprite to be deleted.
This function will delete a sprite from the game, freeing any memory that was reserved for it. This is a permanent removal, and if the asset that you delete was included as part of the game's resources, not even restarting the game (unless you close the application first) will recover it. This is a very important function for those moments when you need to create and change sprites from external resources and should always be used to remove those assets that are no longer needed by a game, or to clear an indexed asset from a variable before re-assigning another asset to that variable. This cannot be used to delete sprites that are included in the game as part of the resource tree.IMPORTANT! This function is not available with the Trial Licence of the product.
var spr =
sprite_create_from_surface(application_surface, 0, 0, 32, 32,
false, false, 16, 16);
The above code creates a local variable and then stores the index of the sprite created from the application surface. This sprite is then merged with the asset indexed in the variable "spr_Player" before being removed from memory again.