fixed overlap chec

This commit is contained in:
0x81c 2015-03-16 08:47:08 -04:00
parent df7dd1b1f3
commit cd2e0d862a
4 changed files with 44 additions and 11 deletions

View file

@ -10,7 +10,7 @@ function Entity:initialize(t)
self.collision = t.collision --"none", "moveable", "unmoveable"
self.sprite = t.sprite
self.shaAmount = t.sha or 1
self.onBump = t.onBump or function() return true end
self.onBump = t.onBump or function(self) return true end
self.drawOffset = {x = 0, y = 0}
if self.size.w < 1 or self.size.h < 1 then
@ -19,6 +19,13 @@ function Entity:initialize(t)
end
end
Entity.static.positionsAreEqual = function(cell1, cell2)
if cell1.x == cell2.x and cell1.y == cell2.y then
return true
end
return false
end
function Entity:getCollision()
return self.collision
end
@ -126,5 +133,5 @@ function Entity:sha()
end
function Entity:bump()
return self.onBump()
return self:onBump()
end