From 31c887c1e864d2eb93712bd60e88cc27d8880793 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Sun, 28 Apr 2019 11:04:05 +0200 Subject: [PATCH] add coins hud --- right_coin.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/right_coin.lua b/right_coin.lua index 58fb56b..54b79b6 100644 --- a/right_coin.lua +++ b/right_coin.lua @@ -14,8 +14,11 @@ GameState = { start=0, game=1, gameover=2, market=3 } currentState = GameState.game life=100 coinBlue=0 +valueBlue=1.0 coinRed=0 +valueRed=1.0 coinYellow=0 +valueYellow=1.0 solids={} do @@ -165,6 +168,19 @@ function drawGame() spr(86,i,0,0) end spr(85,100,0,0,1,1) + + -- Coins / market + local coinsOff=110 + spr(80,coinsOff,0) + print("x"..coinBlue,coinsOff+s,2) + spr(81,coinsOff+25,0) + print("x"..coinRed,coinsOff+25+s,2) + spr(82,coinsOff+50,0) + print("x"..coinYellow,coinsOff+50+s,2) + -- spr(84,190,0) + print(valueBlue,190,2,8) + print(valueRed,206,2,6) + print(valueYellow,222,2,14) end function drawMarket() @@ -212,6 +228,7 @@ function update(state) if currentState == GameState.start then if btnp(4) then -- A (Z key) currentState = GameState.game + life=100 end elseif currentState == GameState.game then updateGame()