From 77311a803b628af818ea6fc4fafb465feb2888e6 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 9 Nov 2020 15:59:05 +0100 Subject: [PATCH] fix: fix function getActorsInRect --- birb/modules/world/baseworld.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/birb/modules/world/baseworld.lua b/birb/modules/world/baseworld.lua index 35b0cdb..b68e6cb 100644 --- a/birb/modules/world/baseworld.lua +++ b/birb/modules/world/baseworld.lua @@ -142,14 +142,14 @@ function BaseWorld:getActorsInRect(x, y, w, h) local query = {} local x2, y2 = x + w, y + h for i,v in ipairs(self.actors) do - if (v.x >= x) and (v.x + v.w >= x1) and - (v.y >= y) and (v.y + v.h >= y1) then + if (v.x >= x) and (v.x + v.w <= x2) and + (v.y >= y) and (v.y + v.h <= y2) then table.insert(query, v) end end - return v + return query end @@ -189,7 +189,7 @@ function BaseWorld:registerBody(body) end function BaseWorld:updateBody(body) - return x, y, {}, 0 + return 0, 0, {}, 0 end function BaseWorld:removeBody(body)