I'm trying to get the XY coordinates of a moving sprite in SmileBASIC, and I can't figure it out. I have the single variable returned from SPCHK, but when I print it, I get a single number '4' constantly as the sprite moves. How do I get each bit?
From the documentation: Return Values for SPCHK |b00| XY-coordinates (1), #CHKXY |b01| Z-coordinates (2), #CHKZ |b02| UV-coordinates (4), #CHKUV |b03| Definition number (8), #CHKI |b04| Rotation (16), #CHKR |b05| Magnification XY (32), #CHKS |b06| Display color (64), #CHKC |b07| Variable (128), #CHKV
For each bit, a target is assigned (If 0 is assigned for all bits, animation is being stopped)
SPCHK
only tells you which properties are currently being animated, not their values.
To get the actual position, you can use SPOFS id OUT x,y
Example:
SPSET 0,17
SPANIM 0,"XY",-10,100,100
WAIT 5
SPOFS 0 OUT X,Y
?X,Y 'should be 50,50