diff options
Diffstat (limited to 'Levels/Level.gd')
-rw-r--r-- | Levels/Level.gd | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Levels/Level.gd b/Levels/Level.gd index 17975ef..40c75ff 100644 --- a/Levels/Level.gd +++ b/Levels/Level.gd @@ -21,8 +21,11 @@ func _ready(): Network.connect("player_changed", func(id): var remote_player = Network.players[id] + var node_name = "%s_%s_%s" % [remote_player.name, remote_player.character, id] - var puppet = self.get_node(node_name) + var puppet = null + if self.has_node(node_name): + puppet = self.get_node(node_name) if remote_player.current_level != self.idx: if puppet: @@ -34,8 +37,11 @@ func _ready(): puppet.process_mode = PROCESS_MODE_DISABLED self.add_child(puppet) puppet.name = node_name + puppet.modulate = Color(1.0, 1.0, 1.0, 0.5) else: puppet.position = remote_player.position + puppet.get_node("Sprite2D").play(remote_player.animation) + puppet.get_node("Sprite2D").flip_h = remote_player.animation_flip_h ) if has_node("ParallaxBackground"): |