godot-webrtc-mplayer-testing/scripts/screens/game.gd
Daniel Flanagan d2abbb69f2 WIP
2021-12-08 23:39:56 -06:00

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()