tweak coin spawn rules
This commit is contained in:
parent
be5154ded3
commit
94d8135a92
|
@ -65,6 +65,7 @@ end
|
||||||
|
|
||||||
coinCooldown=160
|
coinCooldown=160
|
||||||
coinTimer=coinCooldown
|
coinTimer=coinCooldown
|
||||||
|
maxCoin=6
|
||||||
initialCoinDrop=4
|
initialCoinDrop=4
|
||||||
coinSpawnCount=2
|
coinSpawnCount=2
|
||||||
colors={"blue","red","yellow"}
|
colors={"blue","red","yellow"}
|
||||||
|
@ -129,7 +130,7 @@ function randomValidSpawnLoc()
|
||||||
end
|
end
|
||||||
|
|
||||||
function canAddCoin()
|
function canAddCoin()
|
||||||
return #coins < #spawnLocs
|
return #coins < maxCoin
|
||||||
end
|
end
|
||||||
|
|
||||||
function addRandomCoin()
|
function addRandomCoin()
|
||||||
|
@ -543,7 +544,9 @@ function updateGame()
|
||||||
currentState = GameState.market
|
currentState = GameState.market
|
||||||
end
|
end
|
||||||
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
|
if coinTimer == 0 then
|
||||||
for i=1, coinSpawnCount do
|
for i=1, coinSpawnCount do
|
||||||
addRandomCoin()
|
addRandomCoin()
|
||||||
|
|
Loading…
Reference in a new issue