Optimiced collision so noncollidable objects are skipped first

This commit is contained in:
bizcochito 2022-02-05 12:38:08 +01:00
parent cbf29ced65
commit dedb0d884c
1 changed files with 6 additions and 6 deletions

View File

@ -24,18 +24,18 @@ end
-- returns true if theres a collision at that point. also marks collisioned tile as collision true
function isThereObjectAt(x,y,objectType)
local result = false
for _, collision in pairs(objectType) do
if x >= collision.from.x
if collision.disable then
-- Dont calculate if dissabled
elseif x >= collision.from.x
and x <= collision.to.x
and y >= collision.from.y
and y <= collision.to.y
and collision.disable ~= true then
result = true
and y <= collision.to.y then
collision.collision = true
return true
end
end
return result
return false
end
function isThereAnyCollisionAt(x,y)