add coins hud

master
Fabien Freling 2019-04-28 11:04:05 +02:00
parent 0419311f63
commit 31c887c1e8
1 changed files with 17 additions and 0 deletions

View File

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