removeSprite()
Purpose
Remove a sprite that is no longer needed
Description
Free up the memory allocated to a sprite so that it can be reused
Syntax
removeSprite( sprite )
Arguments
handle The handle of the created sprite
Example
image = loadImage( "Untied Games/Enemy small top C", false )
ship = createSprite()
setSpriteImage( ship, image )
lastpos = { gWidth() / 2, gHeight() / 2 }
setSpriteLocation( ship, lastpos )
setSpriteScale( ship, { 4, 4 } )
drawSprites()
update()
sleep( 3 )
clear()
removeSprite( ship )
drawSprites() // nothing is drawn
update()
sleep( 3 )
Associated Commands
createSprite(), deltaTime(), drawSprites(), updateSprites(), updateSprite()