From a17da1133825ffe1bd4a8831fd68a4797b87659f Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Sun, 28 Apr 2019 15:56:06 +0200 Subject: [PATCH] compute coins value --- right_coin.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/right_coin.lua b/right_coin.lua index ec84f9e..789d8db 100644 --- a/right_coin.lua +++ b/right_coin.lua @@ -13,11 +13,11 @@ mh=h/s GameState = { start=0, game=1, gameover=2, market=3 } currentState = GameState.game life=100 -coinBlue=5 +coinBlue=0 valueBlue=1.0 -coinRed=2 +coinRed=0 valueRed=5.0 -coinYellow=21 +coinYellow=0 valueYellow=0.8 MarketOptions = { blue=0, red=1, yellow=2, all=3, done=4 } marketSelection = MarketOptions.blue @@ -438,6 +438,13 @@ function updateGame() if coinTimer == 0 then addRandomCoin() end p:direct() p:update() + + -- Coin market + valueBlue=math.floor((math.sin(t/100)+1)*10)/10 + if t%60 == 0 then + valueRed=math.random(0,99)/10 + end + valueYellow=0.1*coinYellow*coinYellow end function updateMarket()