27 lines
777 B
GDScript
27 lines
777 B
GDScript
extends Node2D
|
|
|
|
onready var player = preload("res://objects/player.tscn")
|
|
|
|
onready var camera = $camera
|
|
onready var camera_target = null
|
|
onready var zoom_levels = [0.25, 0.5, 1, 1.5, 2, 2.5, 3]
|
|
onready var current_zoom_level_index = 2
|
|
|
|
func _ready():
|
|
# TODO: probably have to wait for all peers to be ready before we add players
|
|
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.name = Global.negotiator.peer_by_peer_id(peer_id).name
|
|
new_player.set_network_master(peer_id)
|
|
add_child(new_player)
|
|
new_player.global_position = Vector2(100, 100)
|
|
print("Added player: %s for peer %s" % [new_player, peer_id])
|
|
|
|
func _on_Button_pressed():
|
|
Global.main_menu()
|