summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Characters/Character.gd6
-rw-r--r--Levels/Level.gd8
-rw-r--r--Network/Network.gd2
3 files changed, 15 insertions, 1 deletions
diff --git a/Characters/Character.gd b/Characters/Character.gd
index ee10c0e..c9eaa0a 100644
--- a/Characters/Character.gd
+++ b/Characters/Character.gd
@@ -115,6 +115,12 @@ func _physics_process(delta):
if Network.player.position != self.position:
Network.player.position = self.position
Network.update_player()
+ if Network.player.animation != $Sprite2D.animation:
+ Network.player.animation = $Sprite2D.animation
+ Network.update_player()
+ if Network.player.animation_flip_h != $Sprite2D.flip_h:
+ Network.player.animation_flip_h = $Sprite2D.flip_h
+ Network.update_player()
func is_running():
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"):
diff --git a/Network/Network.gd b/Network/Network.gd
index ce4952c..ac808da 100644
--- a/Network/Network.gd
+++ b/Network/Network.gd
@@ -29,6 +29,8 @@ func create_player():
components = [],
current_level = -1,
position = Vector2(0, 0),
+ animation = "",
+ animation_flip_h = false,
}