done for tonight

This commit is contained in:
Simon Kellet
2024-07-21 21:24:12 +01:00
parent cdc0f35f22
commit 9e968b9390
12 changed files with 54 additions and 22 deletions
+2 -2
View File
@@ -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()
+2
View File
@@ -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
View File
@@ -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