add coins hud
This commit is contained in:
parent
0419311f63
commit
31c887c1e8
|
@ -14,8 +14,11 @@ GameState = { start=0, game=1, gameover=2, market=3 }
|
||||||
currentState = GameState.game
|
currentState = GameState.game
|
||||||
life=100
|
life=100
|
||||||
coinBlue=0
|
coinBlue=0
|
||||||
|
valueBlue=1.0
|
||||||
coinRed=0
|
coinRed=0
|
||||||
|
valueRed=1.0
|
||||||
coinYellow=0
|
coinYellow=0
|
||||||
|
valueYellow=1.0
|
||||||
|
|
||||||
solids={}
|
solids={}
|
||||||
do
|
do
|
||||||
|
@ -165,6 +168,19 @@ function drawGame()
|
||||||
spr(86,i,0,0)
|
spr(86,i,0,0)
|
||||||
end
|
end
|
||||||
spr(85,100,0,0,1,1)
|
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
|
end
|
||||||
|
|
||||||
function drawMarket()
|
function drawMarket()
|
||||||
|
@ -212,6 +228,7 @@ function update(state)
|
||||||
if currentState == GameState.start then
|
if currentState == GameState.start then
|
||||||
if btnp(4) then -- A (Z key)
|
if btnp(4) then -- A (Z key)
|
||||||
currentState = GameState.game
|
currentState = GameState.game
|
||||||
|
life=100
|
||||||
end
|
end
|
||||||
elseif currentState == GameState.game then
|
elseif currentState == GameState.game then
|
||||||
updateGame()
|
updateGame()
|
||||||
|
|
Loading…
Reference in a new issue