2021-11-15 15:43:33 -06:00
|
|
|
extends Node2D
|
|
|
|
|
2021-12-08 16:35:37 -06:00
|
|
|
onready var player = preload("res://objects/player.tscn")
|
2021-11-15 15:43:33 -06:00
|
|
|
|
|
|
|
func _ready():
|
2021-12-09 22:11:02 -06:00
|
|
|
# TODO: probably have to wait for all peers to be ready before we add players
|
2021-12-08 16:35:37 -06:00
|
|
|
rpc("add_player", get_tree().get_network_unique_id())
|
2021-11-15 15:43:33 -06:00
|
|
|
|
2021-12-08 16:35:37 -06:00
|
|
|
func _process(delta):
|
|
|
|
pass
|
2021-11-15 15:43:33 -06:00
|
|
|
|
2021-12-08 16:35:37 -06:00
|
|
|
remotesync func add_player(peer_id):
|
|
|
|
var new_player = player.instance()
|
|
|
|
new_player.set_network_master(peer_id)
|
|
|
|
add_child(new_player)
|
2021-12-08 23:39:56 -06:00
|
|
|
new_player.global_position = Vector2(100, 100)
|
|
|
|
print("Added player: %s" % new_player)
|
2021-11-15 15:43:33 -06:00
|
|
|
|
|
|
|
func _on_Button_pressed():
|
2021-11-17 08:18:12 -06:00
|
|
|
Global.main_menu()
|