Skip to content

Commit a971c3e

Browse files
committed
refactor: simplify interface
Removed the stats box for time and space complexity to allow for future average-of-five scoring system.
1 parent 85dfe67 commit a971c3e

File tree

4 files changed

+101
-98
lines changed

4 files changed

+101
-98
lines changed

scenes/levels_redesign.tscn

Lines changed: 49 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -61,96 +61,95 @@ margin_right = 1240.0
6161
margin_bottom = 680.0
6262
size_flags_vertical = 3
6363

64-
[node name="CodeContainer" type="MarginContainer" parent="Levels/Level"]
64+
[node name="Left" 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/Level/CodeContainer"]
70+
[node name="Code" type="Label" parent="Levels/Level/Left"]
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
76+
text = "\"\"\"
77+
This is a description for the level in the form of psuedocode.
78+
\"\"\"
7679
77-
[node name="Info" type="VBoxContainer" parent="Levels/Level"]
80+
def algorithm(parameter):
81+
return result"
82+
autowrap = true
83+
84+
[node name="Right" type="VBoxContainer" parent="Levels/Level"]
7885
margin_left = 624.0
7986
margin_right = 1240.0
8087
margin_bottom = 613.0
8188
size_flags_horizontal = 3
8289

83-
[node name="Display" type="MarginContainer" parent="Levels/Level/Info"]
90+
[node name="Display" type="MarginContainer" parent="Levels/Level/Right"]
8491
margin_right = 616.0
85-
margin_bottom = 276.0
92+
margin_bottom = 431.0
8693
size_flags_vertical = 3
8794
script = ExtResource( 3 )
8895

89-
[node name="Footer" type="HBoxContainer" parent="Levels/Level/Info"]
90-
margin_top = 284.0
96+
[node name="Info" type="HBoxContainer" parent="Levels/Level/Right"]
97+
margin_top = 439.0
9198
margin_right = 616.0
9299
margin_bottom = 613.0
93-
size_flags_vertical = 3
94100

95-
[node name="Meta" type="VBoxContainer" parent="Levels/Level/Info/Footer"]
96-
margin_right = 304.0
97-
margin_bottom = 329.0
101+
[node name="ControlsContainer" type="MarginContainer" parent="Levels/Level/Right/Info"]
102+
margin_right = 405.0
103+
margin_bottom = 174.0
98104
size_flags_horizontal = 3
99-
100-
[node name="StatsContainer" type="MarginContainer" parent="Levels/Level/Info/Footer/Meta"]
101-
margin_right = 304.0
102-
margin_bottom = 125.0
105+
size_flags_stretch_ratio = 2.0
103106
script = ExtResource( 3 )
104107

105-
[node name="Stats" type="Label" parent="Levels/Level/Info/Footer/Meta/StatsContainer"]
108+
[node name="Controls" type="Label" parent="Levels/Level/Right/Info/ControlsContainer"]
106109
margin_left = 20.0
107110
margin_top = 20.0
108-
margin_right = 284.0
109-
margin_bottom = 105.0
111+
margin_right = 385.0
112+
margin_bottom = 154.0
113+
size_flags_vertical = 1
114+
text = "These are the controls for the level."
115+
autowrap = true
116+
117+
[node name="ScoresContainer" type="MarginContainer" parent="Levels/Level/Right/Info"]
118+
margin_left = 413.0
119+
margin_right = 616.0
120+
margin_bottom = 174.0
110121
size_flags_horizontal = 3
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
119-
margin_bottom = 329.0
120-
size_flags_vertical = 3
121122
script = ExtResource( 3 )
122123

123-
[node name="Scores" type="VBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer"]
124+
[node name="Scores" type="VBoxContainer" parent="Levels/Level/Right/Info/ScoresContainer"]
124125
margin_left = 20.0
125126
margin_top = 20.0
126-
margin_right = 284.0
127-
margin_bottom = 176.0
127+
margin_right = 183.0
128+
margin_bottom = 154.0
128129

129-
[node name="Header" type="HBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
130-
margin_right = 264.0
131-
margin_bottom = 41.0
130+
[node name="Header" type="HBoxContainer" parent="Levels/Level/Right/Info/ScoresContainer/Scores"]
131+
margin_right = 163.0
132+
margin_bottom = 19.0
132133

133-
[node name="Size" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Header"]
134+
[node name="Size" type="Label" parent="Levels/Level/Right/Info/ScoresContainer/Scores/Header"]
134135
margin_right = 40.0
135-
margin_bottom = 41.0
136-
text = "SIZE
137-
----"
136+
margin_bottom = 19.0
137+
text = "SIZE"
138138

139-
[node name="Time" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Header"]
139+
[node name="Time" type="Label" parent="Levels/Level/Right/Info/ScoresContainer/Scores/Header"]
140140
margin_left = 48.0
141-
margin_right = 264.0
142-
margin_bottom = 41.0
141+
margin_right = 163.0
142+
margin_bottom = 19.0
143143
size_flags_horizontal = 3
144-
text = "HIGH SCORE
145-
----------"
144+
text = "HIGH SCORE"
146145
align = 2
147146

148-
[node name="Data" type="HBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
149-
margin_top = 49.0
150-
margin_right = 264.0
151-
margin_bottom = 156.0
147+
[node name="Data" type="HBoxContainer" parent="Levels/Level/Right/Info/ScoresContainer/Scores"]
148+
margin_top = 27.0
149+
margin_right = 163.0
150+
margin_bottom = 134.0
152151

153-
[node name="Sizes" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Data"]
152+
[node name="Sizes" type="Label" parent="Levels/Level/Right/Info/ScoresContainer/Scores/Data"]
154153
margin_right = 30.0
155154
margin_bottom = 107.0
156155
text = "8
@@ -159,9 +158,9 @@ text = "8
159158
64
160159
128"
161160

162-
[node name="Times" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Data"]
161+
[node name="Times" type="Label" parent="Levels/Level/Right/Info/ScoresContainer/Scores/Data"]
163162
margin_left = 38.0
164-
margin_right = 264.0
163+
margin_right = 163.0
165164
margin_bottom = 107.0
166165
size_flags_horizontal = 3
167166
text = "INF
@@ -172,19 +171,5 @@ INF"
172171
align = 2
173172
uppercase = true
174173

175-
[node name="ControlsContainer" type="MarginContainer" parent="Levels/Level/Info/Footer"]
176-
margin_left = 312.0
177-
margin_right = 616.0
178-
margin_bottom = 329.0
179-
size_flags_horizontal = 3
180-
script = ExtResource( 3 )
181-
182-
[node name="Controls" type="Label" parent="Levels/Level/Info/Footer/ControlsContainer"]
183-
margin_left = 20.0
184-
margin_top = 155.0
185-
margin_right = 284.0
186-
margin_bottom = 174.0
187-
size_flags_horizontal = 3
188-
189174
[node name="Timer" type="Timer" parent="Levels"]
190175
[connection signal="timeout" from="Levels/Timer" to="Levels" method="_on_Timer_timeout"]

scenes/menu.tscn

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,68 +21,86 @@ __meta__ = {
2121
[node name="MainMenu" type="VBoxContainer" parent="."]
2222
margin_left = 40.0
2323
margin_top = 30.0
24-
margin_right = 1240.0
24+
margin_right = 1239.0
2525
margin_bottom = 690.0
2626
script = ExtResource( 1 )
2727

2828
[node name="Title" type="Label" parent="MainMenu"]
29-
margin_right = 1200.0
29+
margin_right = 1199.0
3030
margin_bottom = 19.0
3131
text = "Human Computer Simulator"
3232
uppercase = true
3333

3434
[node name="Display" type="MarginContainer" parent="MainMenu"]
3535
margin_top = 27.0
36-
margin_right = 1200.0
36+
margin_right = 1199.0
3737
margin_bottom = 625.0
3838
size_flags_vertical = 3
3939
script = ExtResource( 3 )
4040
__meta__ = {
4141
"_edit_use_anchors_": false
4242
}
4343

44-
[node name="Instructions" type="MarginContainer" parent="MainMenu/Display"]
44+
[node name="InstructionsContainer" type="MarginContainer" parent="MainMenu/Display"]
4545
visible = false
46-
margin_left = 480.0
47-
margin_top = 201.0
48-
margin_right = 720.0
49-
margin_bottom = 397.0
46+
margin_left = 504.0
47+
margin_top = 197.0
48+
margin_right = 694.0
49+
margin_bottom = 401.0
5050
size_flags_horizontal = 4
5151
size_flags_vertical = 4
5252
script = ExtResource( 3 )
5353

54-
[node name="VBoxContainer" type="VBoxContainer" parent="MainMenu/Display/Instructions"]
54+
[node name="Instructions" type="VBoxContainer" parent="MainMenu/Display/InstructionsContainer"]
5555
margin_left = 20.0
5656
margin_top = 20.0
57-
margin_right = 220.0
58-
margin_bottom = 176.0
57+
margin_right = 170.0
58+
margin_bottom = 184.0
59+
custom_constants/separation = 16
5960

60-
[node name="Label" type="Label" parent="MainMenu/Display/Instructions/VBoxContainer"]
61-
margin_right = 200.0
61+
[node name="Controls" type="HBoxContainer" parent="MainMenu/Display/InstructionsContainer/Instructions"]
62+
margin_right = 150.0
63+
margin_bottom = 129.0
64+
custom_constants/separation = 20
65+
66+
[node name="Keys" type="Label" parent="MainMenu/Display/InstructionsContainer/Instructions/Controls"]
67+
margin_right = 10.0
6268
margin_bottom = 129.0
6369
size_flags_horizontal = 4
64-
text = "W - bigger
65-
A - slower
66-
S - smaller
67-
D - faster
68-
M - toggle sound
69-
F - big preview mode"
70-
71-
[node name="Button" type="Button" parent="MainMenu/Display/Instructions/VBoxContainer"]
72-
margin_top = 137.0
73-
margin_right = 200.0
74-
margin_bottom = 156.0
70+
text = "W
71+
A
72+
S
73+
D
74+
M
75+
F"
76+
77+
[node name="Actions" type="Label" parent="MainMenu/Display/InstructionsContainer/Instructions/Controls"]
78+
margin_left = 30.0
79+
margin_right = 150.0
80+
margin_bottom = 129.0
81+
text = "bigger
82+
slower
83+
smaller
84+
faster
85+
sound
86+
big preview "
87+
align = 2
88+
89+
[node name="Button" type="Button" parent="MainMenu/Display/InstructionsContainer/Instructions"]
90+
margin_top = 141.0
91+
margin_right = 150.0
92+
margin_bottom = 160.0
7593
text = "OK"
7694

7795
[node name="Spacing" type="Control" parent="MainMenu"]
7896
margin_top = 633.0
79-
margin_right = 1200.0
97+
margin_right = 1199.0
8098
margin_bottom = 633.0
8199

82100
[node name="Buttons" type="HBoxContainer" parent="MainMenu"]
83-
margin_left = 20.0
101+
margin_left = 19.0
84102
margin_top = 641.0
85-
margin_right = 1180.0
103+
margin_right = 1179.0
86104
margin_bottom = 660.0
87105
size_flags_horizontal = 4
88106
custom_constants/separation = 500
@@ -109,7 +127,7 @@ text = "CREDITS"
109127
[node name="Timer" type="Timer" parent="."]
110128
wait_time = 0.25
111129
autostart = true
112-
[connection signal="pressed" from="MainMenu/Display/Instructions/VBoxContainer/Button" to="MainMenu" method="_on_Button_pressed"]
130+
[connection signal="pressed" from="MainMenu/Display/InstructionsContainer/Instructions/Button" to="MainMenu" method="_on_Button_pressed"]
113131
[connection signal="pressed" from="MainMenu/Buttons/Help" to="MainMenu" method="_on_Help_pressed"]
114132
[connection signal="pressed" from="MainMenu/Buttons/Start" to="MainMenu" method="_on_Start_pressed"]
115133
[connection signal="pressed" from="MainMenu/Buttons/Credits" to="MainMenu" method="_on_Credits_pressed"]

scripts/levels_redesign.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ 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 $Level/Info/Display.get_children():
29+
for child in $Level/Right/Display.get_children():
3030
child.queue_free()
31-
$Level/Info/Display.add_child(ArrayView.new(_level))
31+
$Level/Right/Display.add_child(ArrayView.new(_level))
3232
$Timer.start()
3333
_load_scores(_level)
3434

3535
func _load_scores(level):
36-
var data = $Level/Info/Footer/Meta/ScoresContainer/Scores/Data
36+
var data = $Level/Right/Info/ScoresContainer/Scores/Data
3737
data.get_node("Times").text = ""
3838
for i in data.get_node("Sizes").text.split("\n"):
3939
var time = str(GlobalScore.get_time(level.NAME, int(i)))

scripts/menu.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ func _on_Credits_pressed():
1414
GlobalScene.change_scene("res://scenes/credits.tscn")
1515

1616
func _on_Help_pressed():
17-
$Display/Instructions.show()
17+
$Display/InstructionsContainer.show()
1818
$Display/HBoxContainer.hide()
19-
$Display/Instructions/VBoxContainer/Button.grab_focus()
19+
$Display/InstructionsContainer/Instructions/Button.grab_focus()
2020

2121
func _on_Timer_timeout():
2222
_level.next(null)
@@ -27,6 +27,6 @@ func _input(event):
2727
get_tree().quit()
2828

2929
func _on_Button_pressed():
30-
$Display/Instructions.hide()
30+
$Display/InstructionsContainer.hide()
3131
$Display/HBoxContainer.show()
3232
$Buttons/Start.grab_focus()

0 commit comments

Comments
 (0)