make life deadlier

master
Fabien Freling 2019-04-29 13:16:21 +02:00
parent 5bbf5c1768
commit 361dcb7d0f
1 changed files with 11 additions and 6 deletions

View File

@ -22,6 +22,8 @@ valueYellow=0.8
MarketOptions = { blue=0, red=1, yellow=2, all=3, done=4 }
marketSelection = MarketOptions.blue
secondsAlive=0
sickCounter=20 -- how many seconds before the sickness get stronger?
sickLapse=20 -- how many ticks before the life decreases?
solids={}
do
@ -519,12 +521,18 @@ function updateGame()
currentState = GameState.gameover
return
end
if t%20 == 0 then
if t%sickLapse == 0 then
life=life-1
end
if t%60 == 0 then
sickCounter = sickCounter - 1
secondsAlive = secondsAlive + 1
end
if sickCounter==0 and sickLapse>3 then
sickLapse=sickLapse-2
sickCounter=20
end
p:direct()
p:update()
@ -534,9 +542,6 @@ function updateGame()
currentState = GameState.market
end
end
-- if btnp(5) then -- B (X key)
-- currentState = GameState.gameover
-- end
if coinTimer>0 then coinTimer=coinTimer-1 end
if coinTimer == 0 then
for i=1, coinSpawnCount do
@ -544,12 +549,12 @@ function updateGame()
end
end
-- Coin market
-- Coin market, capped to 9.9
valueBlue=math.floor((math.sin(t/200)+1)*50)/10
if t%60 == 0 then
valueRed=math.random(0,99)/10
end
valueYellow=0.1*coinYellow*coinYellow
valueYellow=math.min(.1*coinYellow*coinYellow, 9.9)
end
function updateMarket()