player respawn, spikes & hazard objects
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user