player respawn, spikes & hazard objects

This commit is contained in:
lustlion
2022-02-10 15:53:50 +01:00
parent 2ce41d541f
commit 7f42dea6fa
9 changed files with 83 additions and 27 deletions

View File

@@ -45,6 +45,14 @@
o.canFall = true
o.canFriction = true
o.maskType = animation.moth_mask
o.anchorRespawn = {
x = o.pos.x,
y = o.pos.y
}
o.anchorRope = {
x = nil,
y = nil
}
-- sprite
o.target_offset = {x = 0, y = 0}
@@ -166,6 +174,15 @@ function Player:DoPhysics()
self.vel.y = 0
end
end
if self:isCollidingAt(self.pos.x, self.pos.y, LoadedObjects.Hazards) then
self:Respawn()
end
end
function Player:Respawn()
self.pos.x = self.anchorRespawn.x
self.pos.y = self.anchorRespawn.y
end
function Player:HandleAnimation()