diff --git a/solitaire.lua b/solitaire.lua index 8ef4320..47ba2b2 100644 --- a/solitaire.lua +++ b/solitaire.lua @@ -52,6 +52,7 @@ left_hold={length=1200,length_display=600,start=nil} should_check_for_win=false WIN_COUNT_SLOT=0 win_count = pmem(WIN_COUNT_SLOT) +game_state='MENU' function create_deck() local cards={} @@ -121,9 +122,42 @@ function BOOT() end function TIC() - render_list={} - update() - draw() + if btnp(6) then reset() end + if game_state=='MENU' then + 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 function update()