Skip to content

Commit 85df253

Browse files
committed
fix: reimplement remembering last played level
Going back to the level select scene will put you on the sort and size that you just played.
1 parent a971c3e commit 85df253

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

scenes/levels_redesign.tscn

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ 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-
\"\"\"
76+
text = "This is a description for the level in the form of psuedocode.
7977
8078
def algorithm(parameter):
8179
return result"

scripts/levels_redesign.gd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ const MAX_WAIT = 4
1818
const MIN_SIZE = 8
1919
const MAX_SIZE = 128
2020

21-
var _index = 0
21+
var _index = LEVELS.find(GlobalScene.get_param("level"))
2222
var _level: ComparisonSort
23-
var _size = ArrayModel.DEFAULT_SIZE
23+
var _size = GlobalScene.get_param("size", ArrayModel.DEFAULT_SIZE)
2424

2525
func _ready():
26+
if _index == -1:
27+
_index = 0
2628
_level = LEVELS[_index].new(ArrayModel.new(_size))
2729
_level.connect("done", self, "_on_ComparisonSort_done")
2830
$NamesContainer/Names/Current.text = _level.NAME

0 commit comments

Comments
 (0)