From 485cd463b22e12394cd232812e2c3789ef37ab1c Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 9 Jan 2021 23:30:27 +0100 Subject: Adds a bunch of characters and fixes things --- UI/CharacterSelect.gd | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 UI/CharacterSelect.gd (limited to 'UI/CharacterSelect.gd') diff --git a/UI/CharacterSelect.gd b/UI/CharacterSelect.gd new file mode 100644 index 0000000..fc84a35 --- /dev/null +++ b/UI/CharacterSelect.gd @@ -0,0 +1,30 @@ +extends Panel + + +var players_selected = {} + + +func _ready(): + self.set_Wait_text() + + +func set_Wait_text(): + $Wait.text = "Waiting for " + str(Network.get_player_count() - self.players_selected.size()) + " players to choose" + + +func _button_pressed(event, character): + if event is InputEventMouseButton or event is InputEventKey: + if event.pressed: + rpc("_character_selected", character) + Network.player.character = character + + +sync func _character_selected(character): + var id = get_tree().get_rpc_sender_id() + if Network.players.has(id): + Network.players[id].character = character + self.players_selected[id] = true + + self.set_Wait_text() + if Network.get_player_count() == self.players_selected.size(): + get_tree().change_scene("res://UI/LevelSelect.tscn") -- cgit v1.2.3