setSpriteScale()
Purpose
Scale a sprite
Description
Scale a sprite up or down in the horizontal and vertical axis
Syntax
setSpriteScale( sprite, scale )
setSpriteScale( sprite, { xScale, yScale } )
sprite.xscale = xScale; sprite.yscale = yScale
Arguments
sprite handle of the created sprite
scale amount to scale the sprite in the horizontal and vertical axes { x, y }
xScale amount to scale the sprite in the horizontal axis
yScale amount to scale the sprite in the vertical axis
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, { 5, 5 } )
loop
clear()
c = controls( 0 )
printAt( 0, 0, "Use left joystick to resize sprite" )
setSpriteScale( ship, { 10 * abs( c.lx ) + 5, 10 * abs( c.ly ) + 5 } )
updateSprites()
drawSprites()
update()
repeat
Associated Commands
getSpriteScale(), getSpriteScaleSpeed(), getSpriteSize(), setSpriteScaleSpeed()