15 lines
330 B
GDScript3
Raw Normal View History

2024-01-23 23:09:50 +00:00
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