summaryrefslogtreecommitdiff
path: root/UI/CharacterSelect.gd
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2021-01-09 23:30:27 +0100
committerDaniel Weipert <code@drogueronin.de>2021-01-09 23:30:27 +0100
commit485cd463b22e12394cd232812e2c3789ef37ab1c (patch)
tree5c455ec9c80b59a9f71ba5827b9902f2beb6df88 /UI/CharacterSelect.gd
parent7920e8758506cd46c58ea4889c9f4fb704abfd16 (diff)
Adds a bunch of characters and fixes things
Diffstat (limited to 'UI/CharacterSelect.gd')
-rw-r--r--UI/CharacterSelect.gd30
1 files changed, 30 insertions, 0 deletions
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")