tweak coin spawn rules

This commit is contained in:
Pascal Batty 2019-04-29 13:27:20 +02:00
parent be5154ded3
commit 94d8135a92

View file

@ -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()