feat: Add menu, reset

main
Louis Pearson 2024-02-17 17:28:44 -07:00
parent 0a3d6d4f24
commit 6f96d801e0
1 changed files with 37 additions and 3 deletions

View File

@ -52,6 +52,7 @@ left_hold={length=1200,length_display=600,start=nil}
should_check_for_win=false should_check_for_win=false
WIN_COUNT_SLOT=0 WIN_COUNT_SLOT=0
win_count = pmem(WIN_COUNT_SLOT) win_count = pmem(WIN_COUNT_SLOT)
game_state='MENU'
function create_deck() function create_deck()
local cards={} local cards={}
@ -121,9 +122,42 @@ function BOOT()
end end
function TIC() function TIC()
render_list={} if btnp(6) then reset() end
update() if game_state=='MENU' then
draw() update_menu();
elseif game_state=='PLAY' then
render_list={}
update()
draw()
end
end
function update_menu()
cls(12)
print(string.format("Win Count: %4d", win_count),160,4,13)
print("Sawayama Solitaire",4,4,2)
print("Press A to Start", 80, 20, 0)
print([[
DPAD: Move cursor
A: Select card, Move, Clear
B: Deselect
X: Reset Game
Hold A: Clear all
]], 4, 36, 15)
print([[
Cards must descend in rank and alternate
colors. Cards are drawn from the deck 3 at a
time and stacked. When all cards have been
drawn, a free space is opened. Cards are
cleared by stacking them in ascending rank
and with matching suites, starting with the
aces of each suite.
]], 4, 78, 15)
local mx,my,mleft,middle,mright,scrollx,scrolly=mouse()
if btnp(4) or btnp(5) or mleft then game_state='PLAY' end
end end
function update() function update()