LoginLogin
Might make SBS readonly: thread

SPANGLE

Root / Documentation / [.]

Created:
Change the rotation of a sprite.

Syntax

SPANGLE id, angle {, time {, direction}}
InputDescription
idSprite id
angleNew sprite angle, in degrees
timeTime to change to new angle, in frames
directionDirection of rotation during interpolation
Changes the rotation of sprite id to the given angle angle. The sprite is rotated around the SPHOME position. If time is provided, the sprite rotates clockwise over time frames to the new angle. If direction is specified, it determines the direction of rotation, with -1 indicating counterclockwise rotation and 1 indicating clockwise rotation.

Examples

'Create sprite (right arrow)
SPSET 0,0,0,0,0,0
'Set rotation point to sprite center
SPHOME 0,8,8
'Rotate arrow 90 degrees clockwise
SPANGLE 0,90
'Arrow is now facing down
'Create sprite (right arrow)
SPSET 0,0,0,0,0,0
'Set rotation point to sprite center
SPHOME 0,8,8
'Rotate arrow 90 degrees counterclockwise over 1 second (60 frames)
SPANGLE 0,270,60,-1
'Arrow is now facing up

Notes

All arguments are rounded down. While any valid number is accepted as an angle, the value will be taken as if the angle was within the range of [0,359]. This means that SPANGLE 0,0,30 is equivalent to SPANGLE 0,360,30, for example. If a sprite is being rotated over time and the rotation is interrupted by another interpolated SPANGLE, the starting angle is the currently interpolated position. The direction argument only impacts the interpolation direction - it does not change the value of the provided angle.

Errors

ActionError
Fewer than two arguments are passedMissing operand
More than four arguments are passedSyntax error
A string argument is passedType Mismatch
A value less than zero or greater than 31 is passed for idOut of range
id does not correspond to an active spriteIllegal function call
A value less than zero is passed for timeOut of range
A value not equal to 1 or -1 is passed for directionOut of range

See Also

No posts yet (will you be the first?)