tiny computer for making, playing and sharing tiny games · By Nesbox
I want to flip between sprite 1 and 2 in an endless loop, which are multiple sprites with a height of 2 but I'm not sure how to make it draw the 2nd frame.
well... I'm a bit confused on what you need. if you could post a screenshot of your spritesheet so I could see what you're doing I'd be able to help you better but here goes.
The easiest way to animate sprites is to use a game time variable (usually named "t" in tic 80) like this:
Local t=0 --initialize it at 0
--game code here
t=t+1 --add to time every frame
Now you can call spr () like this:
spr( sprite_index+t%60//30, x,y)
This will switch between a Sprite cell and the cell directly next to it. If you want to cycle over four sprites for example it'll look like this:
spr( sprite_index+t%120//30, x,y)
This is the method that I use, and like I said if you could elaborate on your question and maybe post some screenshots I could help you better.