fix: fix the actor in rect query
* use x2/y2 as secondary limit comparison * return the query and not an non-initilized variable
This commit is contained in:
parent
ef4bf26ba6
commit
bc45f866c2
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue