blob: 89dba81857dd820327f70e845c34b4773e973875 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
extends Level
onready var buttons = $ButtonHolder.get_children()
var order = [
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
]
var sequence_index = 0
func _ready():
for i in range(buttons.size()):
buttons[i].connect("on_click", self, "_on_AnyButton_click", [i])
buttons[i].text = str(i)
# buttons[i].visible = false
func _on_Any_button_click(btn_idx):
if btn_idx == order[sequence_index]:
sequence_index += 1
print("Correct button: ", btn_idx)
else:
print("Incorrect button: ", btn_idx)
|