done for tonight
This commit is contained in:
+2
-2
@@ -8,8 +8,8 @@ local function drawHealth()
|
||||
love.graphics.setFont(GameFont)
|
||||
local height = love.graphics.getHeight()
|
||||
local width = love.graphics.getWidth()
|
||||
love.graphics.print("" .. UserPlayer1.health, 5, 5)
|
||||
love.graphics.print("" .. UserPlayer2.health, width - 70, height - 95)
|
||||
love.graphics.print("P1:" .. UserPlayer1.health, 5, 5)
|
||||
love.graphics.print("P2:" .. UserPlayer2.health, width - 200, height - 95)
|
||||
end
|
||||
|
||||
function DrawGame()
|
||||
|
||||
@@ -14,6 +14,8 @@ function GameKeyPressed(key)
|
||||
|
||||
--TODO: Better restart
|
||||
if key == "r" and not _G.PAUSED then
|
||||
RestartGame()
|
||||
_G.GAMESTATE = "GAME"
|
||||
love.load()
|
||||
end
|
||||
end
|
||||
|
||||
+6
-7
@@ -1,15 +1,14 @@
|
||||
local function checkWinState()
|
||||
-- Check P1's health
|
||||
if UserPlayer1.health <= 0 then --P1 win
|
||||
_G.P1_WIN = true
|
||||
_G.P2_WIN = false
|
||||
UserPlayer1.health = 0
|
||||
return true
|
||||
end
|
||||
if UserPlayer2.health <= 0 then --P2 win
|
||||
_G.P1_WIN = false
|
||||
_G.P2_WIN = true
|
||||
UserPlayer2.health = 0
|
||||
return true
|
||||
end
|
||||
|
||||
if UserPlayer2.health <= 0 then --P2 win
|
||||
_G.P1_WIN = true
|
||||
_G.P2_WIN = false
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user