fixed game logix
This commit is contained in:
parent
f6be8b2a16
commit
ebf9369ba5
@ -21,7 +21,7 @@ local max = math.max -- optimisations
|
|||||||
function UpdateGame(dt)
|
function UpdateGame(dt)
|
||||||
--Check if anyone has won
|
--Check if anyone has won
|
||||||
if checkLossState() == true then
|
if checkLossState() == true then
|
||||||
print("STATE CHNAGED: WIN!")
|
--print("STATE CHNAGED: WIN!")
|
||||||
_G.GAMESTATE = "WIN"
|
_G.GAMESTATE = "WIN"
|
||||||
end
|
end
|
||||||
--WindField
|
--WindField
|
||||||
@ -57,17 +57,17 @@ function UpdateGame(dt)
|
|||||||
|
|
||||||
-- Hit player2
|
-- Hit player2
|
||||||
if v.collider:enter("Player2") then
|
if v.collider:enter("Player2") then
|
||||||
print("Player1 hit Player2!")
|
--print("Player1 hit Player2!")
|
||||||
table.remove(Bullets1, i)
|
table.remove(Bullets1, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
if UserPlayer1.health > 0 then
|
if UserPlayer2.health > 0 then
|
||||||
UserPlayer1.health = UserPlayer1.health - 1
|
UserPlayer2.health = UserPlayer2.health - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hit player1
|
-- Hit player1
|
||||||
if v.collider:enter("Player1") then
|
if v.collider:enter("Player1") then
|
||||||
print("Player 1 hit themselves!")
|
--print("Player 1 hit themselves!")
|
||||||
table.remove(Bullets1, i)
|
table.remove(Bullets1, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
if UserPlayer1.health > 0 then
|
if UserPlayer1.health > 0 then
|
||||||
@ -100,19 +100,19 @@ function UpdateGame(dt)
|
|||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hit player2
|
-- Hit player1
|
||||||
if v.collider:enter("Player1") then
|
if v.collider:enter("Player1") then
|
||||||
print("Player2 hit Player1!")
|
--print("Player2 hit Player1!")
|
||||||
table.remove(Bullets2, i)
|
table.remove(Bullets2, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
if UserPlayer2.health > 0 then
|
if UserPlayer1.health > 0 then
|
||||||
UserPlayer2.health = UserPlayer2.health - 1
|
UserPlayer1.health = UserPlayer1.health - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hit player1
|
-- Hit player2
|
||||||
if v.collider:enter("Player2") then
|
if v.collider:enter("Player2") then
|
||||||
print("Player 2 hit themselves!")
|
--print("Player 2 hit themselves!")
|
||||||
table.remove(Bullets2, i)
|
table.remove(Bullets2, i)
|
||||||
v.collider:destroy()
|
v.collider:destroy()
|
||||||
if UserPlayer2.health > 0 then
|
if UserPlayer2.health > 0 then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user