main
Simon Kellet 5 months ago
parent 38826d0cd8
commit 26398f52b5
  1. 10
      Game/UpdateGame.lua

@ -1,12 +1,14 @@
local function checkWinState()
local function checkLossState()
-- Check P1's health
if UserPlayer1.health <= 0 then --P1 win
if UserPlayer1.health <= 0 then --P1 Lost, P2 Win
_G.P2_COUNT = _G.P2_COUNT + 1
_G.P1_WIN = false
_G.P2_WIN = true
return true
end
if UserPlayer2.health <= 0 then --P2 win
if UserPlayer2.health <= 0 then --P2 Lost, P1 Win
_G.P1_COUNT = _G.P1_COUNT + 1
_G.P1_WIN = true
_G.P2_WIN = false
return true
@ -18,7 +20,7 @@ local max = math.max -- optimisations
function UpdateGame(dt)
--Check if anyone has won
if checkWinState() == true then
if checkLossState() == true then
print("STATE CHNAGED: WIN!")
_G.GAMESTATE = "WIN"
end

Loading…
Cancel
Save