setSpriteScaleSpeed()
Purpose
Set a sprites scale speeds
Description
Set a sprites scaling speeds. These are the amount that the sprite scale is changed by in the horizontal and vertical axes when updatesprites is called
Syntax
setSpriteScaleSpeed( sprite, scaleSpeed )
setSpriteScaleSpeed( sprite, xScaleSpeed, yScaleSpeed )
sprite.xscale_speed = xScaleSpeed; sprite.yscale_speed = yScaleSpeed
Arguments
sprite handle of the created sprite
scaleSpeed amount to add to the horizontal and vertical scale of the sprite at each updatesprites call { x, y }
xScaleSpeed amount to add to the horizontal scale of the sprite at each updatesprites call
yscaleSpeed 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, { 1, 1 } )
sv = 0
maxsv = 30 // max scale speed
accsv = 0.6 // accelaration
loop
clear()
c = controls( 0 )
printAt( 0, 0, "Use left joystick left or right to change scale speed" )
sv = sv + c.lx * accsv
if abs( sv ) > maxsv then
sv = sv / abs( sv ) * maxsv
endIf
setSpriteScaleSpeed( ship, { sv, sv } )
updateSprites()
drawSprites()
update()
repeat
Associated Commands