Log In  

So I'm new to Pico-8, and I've been studying tutorials on how to get things working. I've been trying to start develop a game state system based off of a tutorial. I've got a very minimal main menu setup with a sprite for a cursor, but for some reason my system that I attempted to replicate for the sake of testing from the tutorial identically just does not run a function, and my screen is just blank. Why wouldn't it be working? Any help would be really appreciated from a new and enthusiastic Pico-8 learner. The code is below:

function _init()
    cls()

    scene="menu"
    cursr_x=64
    player={
    x=0,
    y=0,

    }
end

function update()
 if scene=="menu" then
    update_menu()
 elseif scene=="game"then
    update_game()
 end
end

function draw()
        if scene=="menu"then
            draw_menu()
        elseif scene=="game"then
            draw_game()
        end
end

function draw_menu()
 cls()
 spr(12,20,20)
 spr(18,cursr_x,64)
end

function update_menu()

 --move cursor left
 if btn(⬅️) and cursr==64 then
    cursr_x=32
 elseif btn(⬅️) and cursr==32 then
    cursr_x=96
 elseif btn(⬅️) and cursr==96 then
    cursr_x=64
 end

 --move cursor right
 if btn(➡️) and cursr==64 then
    cursr_x=96
 elseif btn(➡️) and cursr==32 then
    cursr_x=64
 elseif btn(➡️) and cursr==96 then
    cursr_x=32
 end
end
P#100589 2021-11-21 23:46

I think your update and draw functions need to be _update and _draw

P#100594 2021-11-21 23:55

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 02:22:42 | 0.005s | Q:8