Use remotesync instead of the deprecated sync in networking demos

The `sync` keyword has been deprecated since Godot 3.1.
This commit is contained in:
Hugo Locurcio
2021-08-29 12:22:37 +02:00
parent 11a72411cc
commit d1f25ca4aa
5 changed files with 12 additions and 12 deletions

View File

@@ -41,7 +41,7 @@ func _process(delta):
rpc("_reset_ball", true)
sync func bounce(left, random):
remotesync func bounce(left, random):
# Using sync because both players can make it bounce.
if left:
direction.x = abs(direction.x)
@@ -53,11 +53,11 @@ sync func bounce(left, random):
direction = direction.normalized()
sync func stop():
remotesync func stop():
stopped = true
sync func _reset_ball(for_left):
remotesync func _reset_ball(for_left):
position = _screen_size / 2
if for_left:
direction = Vector2.LEFT

View File

@@ -27,7 +27,7 @@ func _ready():
print("Unique id: ", get_tree().get_network_unique_id())
sync func update_score(add_to_left):
remotesync func update_score(add_to_left):
if add_to_left:
score_left += 1
score_left_node.set_text(str(score_left))