More menu work. Begin implementing an inventory system.

This commit is contained in:
Anna Rose Wiggins 2019-12-15 01:01:19 -05:00
parent c86589ec6a
commit fdaefc4e72
2 changed files with 59 additions and 1 deletions

View file

@ -2,12 +2,52 @@ function init_menu()
-- add pause menu items first
menuitem(1, "save game", save_game)
menuitem(2, "erase save data", clear_save)
menu_cursor = 0
menu_map = {
[0] = nil,
[1] = nil,
[2] = save_game
}
end
function menu_input()
menu_mode = false -- todo: implement an actual menu
if btnp(5) then
menu_mode = false
end
-- todo: implement an actual menu control
end
function draw_menu()
menu_draw_inventory()
menu_draw_options()
end
function menu_draw_inventory()
rectfill(0,0,64,64,1)
rect(0,0,64,64,5)
local inv_cursor = 0
for k,v in pairs(inventory) do
if v > 0 then
spr(k, 8, 8+inv_cursor*8)
print(v, 18, 8+inv_cursor*8, 15)
end
end
end
function menu_draw_options()
rectfill(80, 0, 127, 64, 1)
rect(80, 0, 127, 64, 5)
cursor(96, 8)
color(15)
print("eat")
print("build")
print("save")
-- cursor
print("->", 84, 8+menu_cursor*6)
end