Trying to figure out why my teleportation code resulted in the player not being able to move. I wrote the following code:
func teleport_to(target: Node2D):
var level = target.get_parent()
# Move the entire rig
self.reparent(level)
self.global_position = target.global_position
# Move the player
= Vector2.ZERO
player.position if "required_facing" in target:
var spawn_facing = Types.flip_facing(target.required_facing)
stand(spawn_facing)
player.= spawn_facing
player.last_facing
# Update the camera
calculate_limits() camera.
As it turns out, _physics_process
was no longer being called on the player. I'm not
really sure why this is happening, but calling
set_physics_process(true)
fixes the
issue:
func teleport_to(target: Node2D):
# ...
# Move the player
= Vector2.ZERO
player.position set_physics_process(true)
# ...