diff options
author | rom <romangraef@gmail.com> | 2021-04-27 01:14:50 +0200 |
---|---|---|
committer | rom <romangraef@gmail.com> | 2021-04-27 01:14:50 +0200 |
commit | 22a071d1f3d4deb02ee93bfafa5137cdf4068dcd (patch) | |
tree | e06d190f9496a02ebddd5cc224bec914b0b91ab3 | |
parent | 83c97d0e3089a8a9317a9975eb5d031a275a192f (diff) | |
download | ldjam48-22a071d1f3d4deb02ee93bfafa5137cdf4068dcd.tar.gz ldjam48-22a071d1f3d4deb02ee93bfafa5137cdf4068dcd.tar.bz2 ldjam48-22a071d1f3d4deb02ee93bfafa5137cdf4068dcd.zip |
change da order. my final message. goodbye
-rw-r--r-- | scenes/levels/puzzle/puzzle.gd | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scenes/levels/puzzle/puzzle.gd b/scenes/levels/puzzle/puzzle.gd index 982bb29..746e33e 100644 --- a/scenes/levels/puzzle/puzzle.gd +++ b/scenes/levels/puzzle/puzzle.gd @@ -7,10 +7,13 @@ const _button_comp = preload("res://components/button.tscn") const dim = 4 var parts = [] -onready var order = range(dim*dim) +onready var order = [] func _ready(): for i in range(dim*dim-1): + order.append(i+1) + order.append(0) + for i in range(dim*dim-1): var button = _button_comp.instance() var label = Label.new() label.name = "CustomLabel" @@ -32,7 +35,10 @@ func _position_from_index(idx): func _unhandled_input(event): if running and event is InputEventKey and event.pressed and event.scancode == KEY_K: - order = range(dim*dim) + order = [] + for i in range(dim*dim-1): + order.append(i+1) + order.append(0) _render_state() _check_state() @@ -51,9 +57,11 @@ func _render_state(): piece.position = _position_from_index(i) * 80 func _check_state(): - for i in range(dim*dim): - if order[i] != i: + for i in range(dim*dim-1): + if order[i] != i+1: return + if order[dim*dim-1] != 0: + return finish_level() |