power up colliders for both players

main
Simon Kellet 4 months ago
parent 451d710326
commit e13114a736
  1. 17
      Game/UpdateGame.lua

@ -127,6 +127,23 @@ function UpdateGame(dt)
end end
end end
-- PowerUp updates
for i, v in ipairs(PowerUps) do
v:update(dt)
if v.collider:enter("Player1") then
UserPlayer1:getPowerUp(v)
UserPlayer1:powerup()
table.remove(PowerUps, i)
v.collider:destroy()
end
if v.collider:enter("Player2") then
UserPlayer2:getPowerUp(v)
UserPlayer2:powerup()
table.remove(PowerUps, i)
v.collider:destroy()
end
end
UserPlayer1:handleKeys("w", "s", "a", "d", dt) UserPlayer1:handleKeys("w", "s", "a", "d", dt)
UserPlayer2:handleKeys("up", "down", "left", "right", dt) UserPlayer2:handleKeys("up", "down", "left", "right", dt)
UserPlayer1:updateCol() UserPlayer1:updateCol()

Loading…
Cancel
Save