20 lines
447 B
GDScript
20 lines
447 B
GDScript
extends Node2D
|
|
|
|
onready var player = preload("res://objects/player.tscn")
|
|
|
|
func _ready():
|
|
rpc("add_player", get_tree().get_network_unique_id())
|
|
|
|
func _process(delta):
|
|
pass
|
|
|
|
remotesync func add_player(peer_id):
|
|
var new_player = player.instance()
|
|
new_player.set_network_master(peer_id)
|
|
add_child(new_player)
|
|
new_player.global_position = Vector2(100, 100)
|
|
print("Added player: %s" % new_player)
|
|
|
|
func _on_Button_pressed():
|
|
Global.main_menu()
|