summaryrefslogtreecommitdiff
path: root/UI
diff options
context:
space:
mode:
Diffstat (limited to 'UI')
-rw-r--r--UI/CharacterSelect.gd30
-rw-r--r--UI/CharacterSelect.tscn103
-rw-r--r--UI/HUD/LevelMap.gd4
-rw-r--r--UI/HUD/LevelMapCell.gd2
-rw-r--r--UI/LevelSelect.gd2
-rw-r--r--UI/LevelSelectCell.gd2
6 files changed, 140 insertions, 3 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")
diff --git a/UI/CharacterSelect.tscn b/UI/CharacterSelect.tscn
new file mode 100644
index 0000000..5ff2027
--- /dev/null
+++ b/UI/CharacterSelect.tscn
@@ -0,0 +1,103 @@
+[gd_scene load_steps=9 format=2]
+
+[ext_resource path="res://Assets/Characters/Tux/Front.png" type="Texture" id=1]
+[ext_resource path="res://Assets/Characters/Duck/Front.png" type="Texture" id=2]
+[ext_resource path="res://Assets/Fonts/geometry-soft-pro/Geometry_Soft_Pro-Bold_N.otf" type="DynamicFontData" id=3]
+[ext_resource path="res://UI/CharacterSelect.gd" type="Script" id=4]
+[ext_resource path="res://Assets/Characters/Dove/Front.png" type="Texture" id=5]
+[ext_resource path="res://Assets/Characters/Monkey/Front.png" type="Texture" id=6]
+[ext_resource path="res://Assets/Characters/Pidgin/Front.png" type="Texture" id=7]
+
+[sub_resource type="DynamicFont" id=1]
+size = 52
+font_data = ExtResource( 3 )
+
+[node name="CharacterSelect" type="Panel"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 32.0
+margin_top = 24.0
+margin_right = -24.0
+margin_bottom = -16.0
+script = ExtResource( 4 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Title" type="Label" parent="."]
+margin_left = 176.0
+margin_top = 40.0
+margin_right = 724.0
+margin_bottom = 94.0
+custom_fonts/font = SubResource( 1 )
+text = "Choose your Character!"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Wait" type="Label" parent="."]
+margin_left = 544.0
+margin_top = 104.0
+margin_right = 741.0
+margin_bottom = 118.0
+text = "Waiting for x players to choose"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Tux" type="TextureRect" parent="."]
+margin_left = 96.0
+margin_top = 168.0
+margin_right = 128.0
+margin_bottom = 200.0
+rect_scale = Vector2( 2, 2 )
+texture = ExtResource( 1 )
+
+[node name="Duck" type="TextureRect" parent="."]
+margin_left = 288.0
+margin_top = 168.0
+margin_right = 320.0
+margin_bottom = 200.0
+rect_scale = Vector2( 2, 2 )
+texture = ExtResource( 2 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Dove" type="TextureRect" parent="."]
+margin_left = 480.0
+margin_top = 168.0
+margin_right = 512.0
+margin_bottom = 200.0
+rect_scale = Vector2( 2, 2 )
+texture = ExtResource( 5 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Pidgin" type="TextureRect" parent="."]
+margin_left = 672.0
+margin_top = 168.0
+margin_right = 704.0
+margin_bottom = 200.0
+rect_scale = Vector2( 2, 2 )
+texture = ExtResource( 7 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Monkey" type="TextureRect" parent="."]
+margin_left = 96.0
+margin_top = 296.0
+margin_right = 128.0
+margin_bottom = 328.0
+rect_scale = Vector2( 2, 2 )
+texture = ExtResource( 6 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+[connection signal="gui_input" from="Tux" to="." method="_button_pressed" binds= [ "Tux" ]]
+[connection signal="gui_input" from="Duck" to="." method="_button_pressed" binds= [ "Duck" ]]
+[connection signal="gui_input" from="Dove" to="." method="_button_pressed" binds= [ "Dove" ]]
+[connection signal="gui_input" from="Pidgin" to="." method="_button_pressed" binds= [ "Pidgin" ]]
+[connection signal="gui_input" from="Monkey" to="." method="_button_pressed" binds= [ "Monkey" ]]
diff --git a/UI/HUD/LevelMap.gd b/UI/HUD/LevelMap.gd
index 8de38fa..1b4b860 100644
--- a/UI/HUD/LevelMap.gd
+++ b/UI/HUD/LevelMap.gd
@@ -8,9 +8,9 @@ func _ready():
func draw():
var Cell = load("res://UI/HUD/LevelMapCell.tscn")
- var Level = get_parent().get_parent() # HUD > Level
+ #var Level = get_parent().get_parent() # HUD > Level
- for idx in range(Global.Level_Map.size()):
+ for idx in range(Global.Level_Map.size()): # size = 9
var cell = Cell.instance()
cell.level_idx = idx
cell.set_rect_size(150/3, 150/3)
diff --git a/UI/HUD/LevelMapCell.gd b/UI/HUD/LevelMapCell.gd
index 16ff961..a03fc52 100644
--- a/UI/HUD/LevelMapCell.gd
+++ b/UI/HUD/LevelMapCell.gd
@@ -12,6 +12,8 @@ func _ready():
$ClearMark.text = "X"
elif level.cleared_by.idx == Enum.PLAYER.SECOND:
$ClearMark.text = "O"
+ elif level.cleared_by.idx == Enum.PLAYER.THIRD:
+ $ClearMark.text = "P"
$Time.text = str(level.time) + "s"
$Name.text = level.cleared_by.name
diff --git a/UI/LevelSelect.gd b/UI/LevelSelect.gd
index 7abc5f2..2d40a36 100644
--- a/UI/LevelSelect.gd
+++ b/UI/LevelSelect.gd
@@ -9,7 +9,7 @@ func _ready():
func draw():
var Cell = load("res://UI/LevelSelectCell.tscn")
- for idx in range(9):
+ for idx in range(Global.Level_Map.size()): # size = 9
var cell = Cell.instance()
cell.level_idx = idx
cell.set_rect_size(1024/3, 600/3)
diff --git a/UI/LevelSelectCell.gd b/UI/LevelSelectCell.gd
index 16ff961..a03fc52 100644
--- a/UI/LevelSelectCell.gd
+++ b/UI/LevelSelectCell.gd
@@ -12,6 +12,8 @@ func _ready():
$ClearMark.text = "X"
elif level.cleared_by.idx == Enum.PLAYER.SECOND:
$ClearMark.text = "O"
+ elif level.cleared_by.idx == Enum.PLAYER.THIRD:
+ $ClearMark.text = "P"
$Time.text = str(level.time) + "s"
$Name.text = level.cleared_by.name