15 lines
330 B
GDScript

extends PacketHandler
@export var player_scene: PackedScene
func _ready():
%Client.set_handler(Packet.SPAWN, self)
func handle_packet(_data: PackedByteArray, _peer: PacketPeer):
Global.player = spawn_player()
func spawn_player() -> Player:
var player = player_scene.instantiate()
%Players.add_child(player)
return player