瀏覽代碼

Use `network_peer` as a property instead of using the setter method

Hugo Locurcio 5 年之前
父節點
當前提交
726fe7ca1f
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      tutorials/networking/high_level_multiplayer.rst

+ 3 - 3
tutorials/networking/high_level_multiplayer.rst

@@ -85,7 +85,7 @@ Initializing as a server, listening on the given port, with a given maximum numb
 
 
     var peer = NetworkedMultiplayerENet.new()
     var peer = NetworkedMultiplayerENet.new()
     peer.create_server(SERVER_PORT, MAX_PLAYERS)
     peer.create_server(SERVER_PORT, MAX_PLAYERS)
-    get_tree().set_network_peer(peer)
+    get_tree().network_peer = peer
 
 
 Initializing as a client, connecting to a given IP and port:
 Initializing as a client, connecting to a given IP and port:
 
 
@@ -93,7 +93,7 @@ Initializing as a client, connecting to a given IP and port:
 
 
     var peer = NetworkedMultiplayerENet.new()
     var peer = NetworkedMultiplayerENet.new()
     peer.create_client(SERVER_IP, SERVER_PORT)
     peer.create_client(SERVER_IP, SERVER_PORT)
-    get_tree().set_network_peer(peer)
+    get_tree().network_peer = peer
 
 
 Get the previously set network peer:
 Get the previously set network peer:
 
 
@@ -111,7 +111,7 @@ Terminating the networking feature:
 
 
 ::
 ::
 
 
-    get_tree().set_network_peer(null)
+    get_tree().network_peer = null
 
 
 (Although it may make sense to send a message first to let the other peers know you're going away instead of letting the connection close or timeout, depending on your game.)
 (Although it may make sense to send a message first to let the other peers know you're going away instead of letting the connection close or timeout, depending on your game.)