summaryrefslogtreecommitdiff
path: root/entity.lua
diff options
context:
space:
mode:
Diffstat (limited to 'entity.lua')
-rw-r--r--entity.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/entity.lua b/entity.lua
index d291717..34e37f0 100644
--- a/entity.lua
+++ b/entity.lua
@@ -38,6 +38,20 @@ function Entity:syncFromPhysicsBody()
self.y = self.body:getY() - self.height + self.physicsHeight / 2
end
+function getEntityCorners(entity)
+ local x = entity.x
+ local y = entity.y
+ local w = entity.physicsWidth
+ local h = entity.physicsHeight
+
+ return {
+ {x = x, y = y},
+ {x = x + w, y = y},
+ {x = x, y = y + h},
+ {x = x + w, y = y + h}
+ }
+end
+
function Entity:getPhysicsBody()
return self.body
end