pico8-0hh1/states/menu.lua

32 lines
574 B
Lua
Raw Normal View History

2022-05-29 18:38:07 +02:00
function stateMenu()
local items = {"play", "rules"}
2022-05-29 19:49:59 +02:00
local selected = 1
local buttons = {
makeButton(10, 10, 30, 6, "play",
function() setState(states.game) end,
function() selected = 1 end),
makeButton(10, 20, 30, 6, "rules",
function() setState(states.rules) end,
function() selected = 2 end)
}
2022-05-29 18:38:07 +02:00
function _enter()
2022-05-29 19:49:59 +02:00
2022-05-29 18:38:07 +02:00
end
return {
_enter = _enter,
_update = function()
for button in all(buttons) do
button:update()
end
end,
_draw = function()
2022-05-29 19:49:59 +02:00
for k,button in ipairs(buttons) do
button:draw(selected == k)
2022-05-29 18:38:07 +02:00
end
end
}
end