added camera

This commit is contained in:
2024-04-18 00:40:40 +02:00
parent d63bb5a3b8
commit a8f41b42c4
3 changed files with 14 additions and 4 deletions

View File

@@ -6,16 +6,18 @@ func _ready():
UdpClient.player_disconnect.connect(_on_player_disconnect)
func _on_player_join(player_client: Dictionary, clients: Array) -> void:
add_player(player_client)
add_player(player_client, true)
for client in clients:
add_player(client)
add_player(client, false)
func add_player(client: Dictionary):
func add_player(client: Dictionary, is_current_player: bool):
var player: Player = preload("res://scenes/player.tscn").instantiate()
player.session_id = client.session_id
player.position = Vector2(client.position.x, client.position.y)
add_child(player)
if is_current_player:
player.make_current()
func _on_button_pressed():
var payload: Dictionary = {