PRESS C TO BLOW.
CTRL + R TO RESET (but you knew it).
Well I'm experimenting with sprites, animations, loops, in other words, with Pico-8.
It's fun and easy, really awesome.
Yay! First cart uploaded! /o/
Looks good. You might make a game where when its light, you can see shadowy enemies, perhaps for a platformer. When it's not lit, you're in the dark and fighting blind. :)
You need a way to tell the game to only update the image if so many 'steps' have gone by. You'll need to keep track of a counter of some kind that counts up from 1 to 30 then resets to 1 after 30. And another bit to keep track of the actual "speed" (I like to use 0.75). Then it's something sort of like:
if(candle.step%0.75==0) then candle.frame+=1 end if Candle.frame>4 then Candle.frame=1 |
(This is assuming 4 frames of animation)
With "Candle.frame" being a way to tell it what frame of animation the candle's in. (Assuming here you have all the 'frames' for your candle listed in an array. IE:
Candle.sprites={8,16,32,64} (Or whatever sprite #s you're using.)
..And then draw your sprite based on whatever Candle.Sprites[candle.frame] is. What that candle.steps%0.75 bit does is roughly figure out how many "Steps" to wait before advancing the next frame. I'm not much good at explaining stuff but I'll clarify a bit if poked!
I am not quite sure that I fully understand. This is what I added for my global variables:
grass.x = 0 grass.y = 0 grass.sprite = {32,33} grass.timer = 1 grass.flip = false grass.speed = 1 |
And in my game update function I added:
if(grass.speed%0.75==0) then grass.sprite+=1 end if grass.sprite>2 then grass.sprite=1 end |
What am I getting wrong? :-/
[Please log in to post a comment]