场景画面效果优化
This commit is contained in:
@@ -12,6 +12,7 @@ const PLAYER_GROUP: String = "net_player"
|
||||
const NET_PATH: String = "/root/Net"
|
||||
|
||||
@onready var spawner: MultiplayerSpawner = $MultiplayerSpawner
|
||||
@onready var player_spawn_pos: Node3D = $PlayerSpawnPos
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -28,6 +29,7 @@ func _ready() -> void:
|
||||
## recursive=true 很关键 —— 节点 authority 不自动继承,Sync 子节点必须一起设。
|
||||
func _create_player(peer_id: int) -> Node:
|
||||
var player := player_scene.instantiate()
|
||||
player.global_position = player_spawn_pos.global_position
|
||||
player.name = str(peer_id)
|
||||
player.add_to_group(PLAYER_GROUP)
|
||||
player.set_multiplayer_authority(peer_id, true)
|
||||
|
||||
Reference in New Issue
Block a user