getSpriteSize()
Purpose
Find the size of a sprite
Description
Find the size of a sprite at the current scale factor. If the sprite was created from a tiled image then the tile size is returned at the current scale factor
Syntax
size = getSpriteSize( sprite )
Arguments
sprite handle of the sprite
size vector containing the width and height of the image (or tile) at the current scale factor { x, y }
Example
image = loadImage( "Untied Games/Player ships", false )
ship = createSprite()
setSpriteImage( ship, image )
setSpriteAnimation( ship, 0, 0, 0 )
setSpriteLocation( ship, { gWidth() / 2, gHeight() / 2 } )
setSpriteScale( ship, { 5, 5 } )
loop
clear()
size = getSpriteSize( ship )
printAt( 0, 0, "Sprite Width: " + size.x )
printAt( 0, 1, "Sprite Height: " + size.y )
drawSprites()
update()
repeat
Associated Commands
getSpriteScale(), getSpriteScaleSpeed(), setSpriteScale(), setSpriteScaleSpeed()