mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-05 07:20:07 +01:00
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:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user