From 778c16dadde15afc6aadec8c50198a9bb5605edf Mon Sep 17 00:00:00 2001 From: geemili Date: Fri, 8 Mar 2024 13:34:53 -0700 Subject: [PATCH] make first game random by moving setup after menu --- solitaire.lua | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/solitaire.lua b/solitaire.lua index 734f694..519ecfb 100644 --- a/solitaire.lua +++ b/solitaire.lua @@ -111,15 +111,6 @@ function BOOT() end return end - - stacks[1] = create_deck() - shuffle(stacks[1]) - table.insert(locations,{1,2,2}) - -- Set up stacks - for i=1,7 do - stacks[i+6]=draw_cards(stacks[1], i) - table.insert(locations,{i+6,i*30,30}) - end end function TIC() @@ -159,7 +150,19 @@ 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 + if btnp(4) or btnp(5) or mleft then + game_state='PLAY' + + -- draw cards + stacks[1] = create_deck() + shuffle(stacks[1]) + table.insert(locations,{1,2,2}) + -- Set up stacks + for i=1,7 do + stacks[i+6]=draw_cards(stacks[1], i) + table.insert(locations,{i+6,i*30,30}) + end + end end function update()