Log In  

Cart #29565 | 2016-09-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


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/

P#29566 2016-09-28 03:24 ( Edited 2017-11-16 01:04)

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. :)

P#29573 2016-09-28 09:31 ( Edited 2016-09-28 13:31)

What code would I need to add to change the speed?

P#45509 2017-10-27 11:39 ( Edited 2017-10-27 15:39)

@MEMalguy:

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!

P#45516 2017-10-27 13:06 ( Edited 2017-10-27 17:06)

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? :-/

Cart #46349 | 2017-11-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#46350 2017-11-15 20:04 ( Edited 2017-11-16 01:04)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 05:44:44 | 0.017s | Q:25