diff --git a/sonic-radiance.love/scenes/overworld/actors/player.lua b/sonic-radiance.love/scenes/overworld/actors/player.lua index e20da85..16c1de1 100644 --- a/sonic-radiance.love/scenes/overworld/actors/player.lua +++ b/sonic-radiance.love/scenes/overworld/actors/player.lua @@ -68,27 +68,29 @@ function Player:updateCurrentCharset() end function Player:collisionResponse(col) - if (not col.other.owner.isDestroyed) then - if (col.other.type == "gizmo") then - if (col.other.owner.needButton) then + local hitbox = col.other + local other = col.other.owner + if (not other.isDestroyed) then + if (hitbox.type == "gizmo") then + if (other.needButton) then if (self.keys["A"].isPressed) then - col.other.owner:doAction() + other:doAction() self.haveCollided = true - self.lastCollision = col.other.owner.creationID + self.lastCollision = other.creationID end else - if (self.lastCollision ~= col.other.owner.creationID) then - col.other.owner:doAction() + if (self.lastCollision ~= other.creationID) then + other:doAction() end self.haveCollided = true - self.lastCollision = col.other.owner.creationID + self.lastCollision = other.creationID end end - if (col.other.type == "btnInput" and col.other.owner.needButton) then - if (self.keys["A"].isPressed and (self:faceRightDirection(col.other.owner))) then - col.other.owner:doAction() + if (hitbox.type == "btnInput" and other.needButton) then + if (self.keys["A"].isPressed and (self:faceRightDirection(other))) then + other:doAction() self.haveCollided = true - self.lastCollision = col.other.owner.creationID + self.lastCollision = other.creationID end end end