LoginLogin
Might make SBS readonly: thread

SPREAD

Root / Documentation / [.]

Created:
Read sprite attributes.

Syntax

SPREAD(id), x {, y {, angle {, scale {, chr}}}}
InputDescription
idSprite id
OutputDescription
xVariable to store current x-coordinate
yVariable to store current y-coordinate
angleVariable to store current sprite rotation angle
scaleVariable to store current sprite scale
chrVariable to store current sprite character
Reads various attributes from a sprite, including position, angle, scale, and character. Useful to check the exact state of interpolated values.

Examples

'Create sprite (boy)
SPSET 0,64,2,0,0,0
'Move sprite to 120,80
SPOFS 0,120,80
'Read and display sprite coordinates
SPREAD(0),X,Y
'120 80
PRINT X,Y
'Create sprite (witch)
SPSET 0,96,2,0,0,0
'Move, scale, and rotate sprite over time
SPOFS 0,200,120,120
SPANGLE 0,180,150
SPSCALE 0,200,180
'Read values partway through changes
WAIT 90
SPREAD(0),X,Y,A,S,C
PRINT X,Y,A,S,C
'150 90  107.996 150 96

Notes

id is rounded down. The values for x, y, and chr will be integers, while angle and scale can have decimal components. There is no way to read the current palette of the sprite.

Errors

ActionError
id is not specifiedSyntax error
More than two arguments are specified within the parenthesisMissing operand
No variables are provided as outputMissing operand
More than five variables are provided as outputIllegal function call
id is less than zero or greater than 100Out of range
id does not correspond to an active spriteIllegal function call

See Also

No posts yet (will you be the first?)