|
|
|
@ -21,7 +21,7 @@ local max = math.max -- optimisations |
|
|
|
|
function UpdateGame(dt) |
|
|
|
|
--Check if anyone has won |
|
|
|
|
if checkLossState() == true then |
|
|
|
|
print("STATE CHNAGED: WIN!") |
|
|
|
|
--print("STATE CHNAGED: WIN!") |
|
|
|
|
_G.GAMESTATE = "WIN" |
|
|
|
|
end |
|
|
|
|
--WindField |
|
|
|
@ -57,17 +57,17 @@ function UpdateGame(dt) |
|
|
|
|
|
|
|
|
|
-- Hit player2 |
|
|
|
|
if v.collider:enter("Player2") then |
|
|
|
|
print("Player1 hit Player2!") |
|
|
|
|
--print("Player1 hit Player2!") |
|
|
|
|
table.remove(Bullets1, i) |
|
|
|
|
v.collider:destroy() |
|
|
|
|
if UserPlayer1.health > 0 then |
|
|
|
|
UserPlayer1.health = UserPlayer1.health - 1 |
|
|
|
|
if UserPlayer2.health > 0 then |
|
|
|
|
UserPlayer2.health = UserPlayer2.health - 1 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Hit player1 |
|
|
|
|
if v.collider:enter("Player1") then |
|
|
|
|
print("Player 1 hit themselves!") |
|
|
|
|
--print("Player 1 hit themselves!") |
|
|
|
|
table.remove(Bullets1, i) |
|
|
|
|
v.collider:destroy() |
|
|
|
|
if UserPlayer1.health > 0 then |
|
|
|
@ -100,19 +100,19 @@ function UpdateGame(dt) |
|
|
|
|
v.collider:destroy() |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Hit player2 |
|
|
|
|
-- Hit player1 |
|
|
|
|
if v.collider:enter("Player1") then |
|
|
|
|
print("Player2 hit Player1!") |
|
|
|
|
--print("Player2 hit Player1!") |
|
|
|
|
table.remove(Bullets2, i) |
|
|
|
|
v.collider:destroy() |
|
|
|
|
if UserPlayer2.health > 0 then |
|
|
|
|
UserPlayer2.health = UserPlayer2.health - 1 |
|
|
|
|
if UserPlayer1.health > 0 then |
|
|
|
|
UserPlayer1.health = UserPlayer1.health - 1 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Hit player1 |
|
|
|
|
-- Hit player2 |
|
|
|
|
if v.collider:enter("Player2") then |
|
|
|
|
print("Player 2 hit themselves!") |
|
|
|
|
--print("Player 2 hit themselves!") |
|
|
|
|
table.remove(Bullets2, i) |
|
|
|
|
v.collider:destroy() |
|
|
|
|
if UserPlayer2.health > 0 then |
|
|
|
|