feat(hitbox): add a way to advertise an hitbox as main hitbox
This commit is contained in:
parent
81c7dc7cd4
commit
f68e300019
2 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue