feat(hitbox): add a way to advertise an hitbox as main hitbox

This commit is contained in:
Kazhnuz 2019-06-27 21:15:57 +02:00
parent 81c7dc7cd4
commit f68e300019
2 changed files with 7 additions and 0 deletions

View File

@ -243,6 +243,7 @@ end
function Actor2D:initMainHitbox()
self.mainHitbox = Hitbox(self, self.type, 0, 0, self.w, self.h, self.isSolid)
self.mainHitbox:advertiseAsMainHitbox()
end
function Actor2D:addHitbox(name, type, ox, oy, w, h, isSolid)

View File

@ -39,10 +39,16 @@ function Hitbox2D:new(owner, type, ox, oy, w, h, isSolid)
self.h = h
self.isSolid = isSolid
self.isMainHitBox = false
self:setDebugColor(0,0,0)
self:register()
end
function Hitbox2D:advertiseAsMainHitbox()
self.isMainHitBox = true
end
function Hitbox2D:modify(ox, oy, w, h)
self.ox = ox
self.oy = oy