added rooms

This commit is contained in:
binarycat
2022-03-04 14:41:45 -05:00
committed by lustlion
parent 2b9f605a0a
commit 5643fc0140
8 changed files with 126 additions and 10 deletions

View File

@@ -162,6 +162,10 @@ end
-- checks if the the reciever would collide with an object if it was positioned at the given point.
-- also marks collisioned tile as collision true
function Entity:isCollidingAt(x,y,object)
return self:getCollidingAt(x,y,object) ~= nil
end
function Entity:getCollidingAt(x,y,object)
for _, collision in pairs(object) do
if collision.disable then
-- Dont calculate if disabled
@@ -171,10 +175,10 @@ function Entity:isCollidingAt(x,y,object)
and y + self.boxCollision.to.y > collision.from.y
then
collision.isColliding = true
return true
return collision
end
end
return false
return nil
end
function Entity:isCollidingWith(entity)