| Posted: 02:39am 13 May 2021 |
Copy link to clipboard |
 Print this post |
|
I'm in the middle of testing a few tests for animating sprites for a project and have come across 1 problem in coding. I am animating a sprite and the sprite animation is dependent on what direction it is moving - so we have 3 sprites each on 4 frames. Animation frame displayed is controlled by an interrupt routine and this seems to work fine. The issue I have found is in this little bit of code....
if x=oldx and (spr<5 or spr>8) then sprite hide spr spr=5 sprstart=5 sprmax=8 sprite show spr,x,y,1 endif This causes a syntax error, but if I call the same code as a subroutine it works without an error.
if x=oldx and (spr<5 or spr>8) then front . . . sub front sprite hide spr:spr=5:sprstart=5:sprmax=8:sprite show spr,x,y,1 end sub
Is there an issue in my code or just a quirk of using sprite commands in if/then statements? |