Skip to content

Commit 1de8689

Browse files
committed
Fix wrong difficulty pre-selected after completion
This commit remembers the difficulty of the level just finished and selects that one after returning to the level screen instead of hard-coding easy mode.
1 parent a4adf1a commit 1de8689

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/levels.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ func _ready():
2929
_load_types($Level/Right/Display/TypesContainer)
3030
_load_types($BigDisplay/TypesContainer)
3131
_reload()
32-
var easy = $Level/Right/Info/ScoresContainer/Scores/Easy/Button
33-
easy.add_color_override("font_color", GlobalTheme.ORANGE)
34-
easy.focus_neighbour_top = $NamesContainer/Names/Current.get_path()
32+
var scores = $Level/Right/Info/ScoresContainer/Scores
33+
scores.get_node("Easy/Button").focus_neighbour_top = $NamesContainer/Names/Current.get_path()
34+
var selectedDifficulty = scores.get_child(log(_size / MIN_SIZE) / log(2)).get_node("Button")
35+
selectedDifficulty.add_color_override("font_color", GlobalTheme.ORANGE)
3536
for difficulty in $Level/Right/Info/ScoresContainer/Scores.get_children():
3637
if difficulty.name != "Controls":
3738
difficulty.get_child(0).connect("pressed", self, "_on_Difficulty_pressed", [difficulty])

0 commit comments

Comments
 (0)