From 94d8135a92a31494db09e9298b826ae4147b4350 Mon Sep 17 00:00:00 2001 From: Pascal Batty Date: Mon, 29 Apr 2019 13:27:20 +0200 Subject: [PATCH] tweak coin spawn rules --- right_coin.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/right_coin.lua b/right_coin.lua index 92821cf..b117108 100644 --- a/right_coin.lua +++ b/right_coin.lua @@ -65,6 +65,7 @@ end coinCooldown=160 coinTimer=coinCooldown +maxCoin=6 initialCoinDrop=4 coinSpawnCount=2 colors={"blue","red","yellow"} @@ -129,7 +130,7 @@ function randomValidSpawnLoc() end function canAddCoin() - return #coins < #spawnLocs + return #coins < maxCoin end function addRandomCoin() @@ -543,7 +544,9 @@ function updateGame() currentState = GameState.market end end - if coinTimer>0 then coinTimer=coinTimer-1 end + + if not canAddCoin() then coinTimer=coinCooldown + elseif coinTimer>0 then coinTimer=coinTimer-1 end if coinTimer == 0 then for i=1, coinSpawnCount do addRandomCoin()