You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steve Paget edited this page Dec 31, 2016
·
5 revisions
Rotates and resizes a sprite relative to its original image
Syntax:
transformSprite(yourSpriteName, angle, scale)
Where:
yourSpriteName is an existing sprite object. angle is an angle, in degrees, travelling anti-clockwise. scale is a number representing the new size, relative to the original image. A scale of 1 is the original size. 0.5 is half size. 2 is double, etc.
Note: The angle and scale is based on the original image, not the most recent angle or current size. Rotations do not add up each time it is called.
eg. transformSprite(player, 0, 2)
This will double the size of the sprite but leave the angle unchanged.
transformSprite(player, 90, 1)
This will rotate the player sprite 90 degrees but leave the size unchanged.
transformSprite(player, 180, 0.25)
This will rotate the player sprite 180 degrees and shrink it to a quarter the original size.