setSpriteVisibility()
Purpose
Hide or reveal a sprite
Description
Sets the visibility of a sprite. If false then the sprite is not displayed
Syntax
setSpriteVisibility( sprite, visibility )
sprite.visible = show
Arguments
sprite handle of the sprite
visibility if true then the sprite is displayed
Example
image = loadimage( "Untied Games/Enemy A", false )
enemy = createsprite()
setSpriteImage( enemy, image )
speed = 20
setSpriteAnimation( enemy, 0, 4, speed )
lastpos = { gWidth() / 2, gHeight() / 2 }
setSpriteLocation( enemy, lastpos )
setSpriteScale(enemy, { 8, 8 } )
loop
clear()
c = controls( 0 )
printAt( 0, 0, "Press the A button to show sprite" )
setSpriteVisibility( enemy, c.a )
updateSprites()
drawSprites()
update()
repeat
Associated Commands