From eab4cbbcdc1d65abb37ab8255432888f0ecfe4b8 Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 12 Mar 2022 13:56:16 -0500 Subject: [PATCH] use Rect:containsPoint in isThereObjectAt --- code/objects.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/code/objects.lua b/code/objects.lua index 7f8aa4e..e31c293 100644 --- a/code/objects.lua +++ b/code/objects.lua @@ -25,10 +25,7 @@ function isThereObjectAt(x,y,objectType) for _, object in pairs(objectType) do if object.is_disabled then -- Dont calculate if dissabled - elseif x >= object.from.x - and x <= object.to.x - and y >= object.from.y - and y <= object.to.y then + elseif object:asRect():containsPoint(Point:new(x, y)) then object.is_colliding = true return true end