How to read output of SPCHK?
Root / Programming Questions / [.]
vvanheeCreated:
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)
It's so your code can check if a particular type of animation is happening, so you can then decide whether to stop it, or to not call SPANIM again...
I think SPOFS gives coordinates relative to the sprite's parent. Most of the time that'll be the top left of the screen, but if SPLINKed then it'll be the origin coordinate of the parent sprite.
(I think... Can't check right now...)