From 26398f52b56d53f6599125b3f3f0217b8c416c2b Mon Sep 17 00:00:00 2001 From: Simon Kellet Date: Mon, 22 Jul 2024 23:28:36 +0100 Subject: [PATCH] fixed wins --- Game/UpdateGame.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Game/UpdateGame.lua b/Game/UpdateGame.lua index e834f98..1dc9441 100644 --- a/Game/UpdateGame.lua +++ b/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