getSpriteScale()
Purpose
Get a sprite's scale factor
Description
This is the amount that the sprite's scale factor is changed by when updatesprites is called
Syntax
scale = getSpriteScale( sprite )
xscale = sprite.xscale; yscale = sprite.yscale
Arguments
handle handle of the created sprite
scale vector containing the scale factor values { x, y }
xscale amount to add to the horizontal scale of the sprite at each updatesprites call
yscale amount to add to the vertical scale of the sprite at each updatesprites call
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, { 10, 10 } )
minsf = 10 // min scale factor
maxsf = 20 // max scale factor
sv = 5
loop
clear()
sf = getSpriteScale( ship )
if sv > 0 and sf.x > maxsf then
sv = -sv
endIf
if sv < 0 and sf.x < minsf then
sv = -sv
endIf
setSpriteScaleSpeed(ship, { sv, sv } )
updateSprites()
drawSprites()
update()
repeat
Associated Commands
getSpriteScaleSpeed(), getSpriteSize(), setSpriteScale(), setSpriteScaleSpeed()