(Formerly known as DeleteSprite, which is now obsolete)
DynamicSprite.Delete();
Deletes the specified dynamic sprite from memory. Use this when you are no longer displaying
the sprite and it can be safely disposed of.
You do not normally need to delete sprites, since the AGS Sprite Cache manages loading
and deleting sprites automatically.
However, when an extra sprite has been loaded into the game (for example, with the
CreateFromFile or CreateFromScreenShot commands) then AGS does not delete it automatically,
and you must call this command instead.
Example:
DynamicSprite* sprite = DynamicSprite.CreateFromFile("CustomAvatar.bmp");
object[1].Graphic = sprite.Graphic;
Wait(200);
object[1].Graphic = 22;
sprite.Delete();
will load the file "CustomAvatar.bmp", change Object 1 to display this graphic, wait 5
seconds, then change object 1 back to its old sprite 22 and free the new image.
See Also: DynamicSprite.CreateFromScreenShot,
DynamicSprite.Graphic
|