Skip to content

Commit b74fed6

Browse files
committed
feat: add placeholder stats and high scores GUI
1 parent c08b9c0 commit b74fed6

File tree

3 files changed

+61
-29
lines changed

3 files changed

+61
-29
lines changed

scenes/levels_redesign.tscn

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,78 +55,111 @@ margin_bottom = 19.0
5555
size_flags_horizontal = 3
5656
text = ">"
5757

58-
[node name="Info" type="HBoxContainer" parent="Levels"]
58+
[node name="Level" type="HBoxContainer" parent="Levels"]
5959
margin_top = 67.0
6060
margin_right = 1240.0
6161
margin_bottom = 680.0
6262
size_flags_vertical = 3
6363

64-
[node name="CodeContainer" type="MarginContainer" parent="Levels/Info"]
64+
[node name="CodeContainer" type="MarginContainer" parent="Levels/Level"]
6565
margin_right = 616.0
6666
margin_bottom = 613.0
6767
size_flags_horizontal = 3
6868
script = ExtResource( 3 )
6969

70-
[node name="Code" type="Label" parent="Levels/Info/CodeContainer"]
70+
[node name="Code" type="Label" parent="Levels/Level/CodeContainer"]
7171
margin_left = 20.0
7272
margin_top = 20.0
7373
margin_right = 596.0
7474
margin_bottom = 593.0
7575
size_flags_vertical = 3
7676

77-
[node name="VBoxContainer" type="VBoxContainer" parent="Levels/Info"]
77+
[node name="Info" type="VBoxContainer" parent="Levels/Level"]
7878
margin_left = 624.0
7979
margin_right = 1240.0
8080
margin_bottom = 613.0
8181
size_flags_horizontal = 3
8282

83-
[node name="Display" type="MarginContainer" parent="Levels/Info/VBoxContainer"]
83+
[node name="Display" type="MarginContainer" parent="Levels/Level/Info"]
8484
margin_right = 616.0
8585
margin_bottom = 302.0
8686
size_flags_vertical = 3
8787
script = ExtResource( 3 )
8888

89-
[node name="HBoxContainer" type="HBoxContainer" parent="Levels/Info/VBoxContainer"]
89+
[node name="Footer" type="HBoxContainer" parent="Levels/Level/Info"]
9090
margin_top = 310.0
9191
margin_right = 616.0
9292
margin_bottom = 613.0
9393
size_flags_vertical = 3
9494

95-
[node name="MarginContainer" type="MarginContainer" parent="Levels/Info/VBoxContainer/HBoxContainer"]
96-
margin_right = 200.0
95+
[node name="Meta" type="VBoxContainer" parent="Levels/Level/Info/Footer"]
96+
margin_right = 304.0
9797
margin_bottom = 303.0
9898
size_flags_horizontal = 3
9999

100-
[node name="Label" type="Label" parent="Levels/Info/VBoxContainer/HBoxContainer/MarginContainer"]
100+
[node name="StatsContainer" type="MarginContainer" parent="Levels/Level/Info/Footer/Meta"]
101+
margin_right = 304.0
102+
margin_bottom = 125.0
103+
script = ExtResource( 3 )
104+
105+
[node name="Stats" type="Label" parent="Levels/Level/Info/Footer/Meta/StatsContainer"]
101106
margin_left = 20.0
102-
margin_top = 142.0
103-
margin_right = 180.0
104-
margin_bottom = 161.0
107+
margin_top = 20.0
108+
margin_right = 284.0
109+
margin_bottom = 105.0
105110
size_flags_horizontal = 3
106-
107-
[node name="MarginContainer2" type="MarginContainer" parent="Levels/Info/VBoxContainer/HBoxContainer"]
108-
margin_left = 208.0
109-
margin_right = 408.0
111+
text = "Best-case time:
112+
Average-case time:
113+
Worst-case time:
114+
Worst-case space:"
115+
116+
[node name="ScoresContainer" type="MarginContainer" parent="Levels/Level/Info/Footer/Meta"]
117+
margin_top = 133.0
118+
margin_right = 304.0
110119
margin_bottom = 303.0
111-
size_flags_horizontal = 3
120+
size_flags_vertical = 3
121+
script = ExtResource( 3 )
112122

113-
[node name="Label" type="Label" parent="Levels/Info/VBoxContainer/HBoxContainer/MarginContainer2"]
123+
[node name="Scores" type="HBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer"]
114124
margin_left = 20.0
115-
margin_top = 142.0
116-
margin_right = 180.0
117-
margin_bottom = 161.0
125+
margin_top = 20.0
126+
margin_right = 284.0
127+
margin_bottom = 150.0
128+
129+
[node name="Sizes" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
130+
margin_right = 30.0
131+
margin_bottom = 129.0
132+
text = "
133+
8
134+
16
135+
32
136+
64
137+
128"
138+
139+
[node name="Times" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
140+
margin_left = 38.0
141+
margin_right = 264.0
142+
margin_bottom = 129.0
118143
size_flags_horizontal = 3
144+
text = "HIGH SCORES
145+
INF
146+
INF
147+
INF
148+
INF
149+
INF"
150+
align = 1
119151

120-
[node name="MarginContainer3" type="MarginContainer" parent="Levels/Info/VBoxContainer/HBoxContainer"]
121-
margin_left = 416.0
152+
[node name="ControlsContainer" type="MarginContainer" parent="Levels/Level/Info/Footer"]
153+
margin_left = 312.0
122154
margin_right = 616.0
123155
margin_bottom = 303.0
124156
size_flags_horizontal = 3
157+
script = ExtResource( 3 )
125158

126-
[node name="Label" type="Label" parent="Levels/Info/VBoxContainer/HBoxContainer/MarginContainer3"]
159+
[node name="Controls" type="Label" parent="Levels/Level/Info/Footer/ControlsContainer"]
127160
margin_left = 20.0
128161
margin_top = 142.0
129-
margin_right = 180.0
162+
margin_right = 284.0
130163
margin_bottom = 161.0
131164
size_flags_horizontal = 3
132165

scripts/levels_redesign.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const LEVELS = [
1616
const MIN_WAIT = 1.0 / 32 # Should be greater than maximum frame time
1717
const MAX_WAIT = 4
1818
const MIN_SIZE = 8
19-
const MAX_SIZE = 256
19+
const MAX_SIZE = 128
2020

2121
var _index = 0
2222
var _level: ComparisonSort
@@ -26,9 +26,9 @@ func _ready():
2626
_level = LEVELS[_index].new(ArrayModel.new(_size))
2727
_level.connect("done", self, "_on_ComparisonSort_done")
2828
$NamesContainer/Names/Current.text = _level.NAME
29-
for child in $Info/VBoxContainer/Display.get_children():
29+
for child in $Level/Info/Display.get_children():
3030
child.queue_free()
31-
$Info/VBoxContainer/Display.add_child(ArrayView.new(_level))
31+
$Level/Info/Display.add_child(ArrayView.new(_level))
3232
$Timer.start()
3333

3434
func _switch_level(index):

scripts/play.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func _input(event):
3131
func _on_Level_done(level):
3232
set_process(false)
3333
var time = get_score()
34-
var moves = level.moves
3534
var restart = Button.new()
3635
restart.text = "RESTART LEVEL"
3736
restart.connect("pressed", self, "_on_Button_pressed", ["play"])

0 commit comments

Comments
 (0)