From a3d5be2b24daa73a239d214169184e13f09df659 Mon Sep 17 00:00:00 2001 From: Clifton James Palmer Date: Sat, 8 Dec 2018 19:19:29 -0600 Subject: [PATCH 1/1] Added collision on stage boundary --- scene.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scene.lua b/scene.lua index bd38c41..793c2ca 100644 --- a/scene.lua +++ b/scene.lua @@ -138,6 +138,16 @@ function scene:handleCollisions() for _,player in pairs(self.players) do local v1 = player.path.vector local v2 = player.path.prev.vector + + -- outside boundary + if v1.x < 0 or v1.x > love.graphics.getWidth() + or v1.y < 0 or v1.y > love.graphics.getHeight() + then + love.event.push('collision', tostring(player)) + break + end + + -- inside boundary for _,player2 in pairs(self.players) do if doesLineIntersectPlayerPaths(player2.path, v1, v2) then love.event.push('collision', tostring(player)) -- 2.47.2