-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtitle.gd
46 lines (34 loc) · 871 Bytes
/
title.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
extends Control
signal start
const INSTRUCTIONS = \
"""Left: %s
Right: %s
Down: %s
Drop: %s
Rotate Counter
Clockwise: %s
Rotate
Clockwise: %s
Pause: %s"""
var _inputs = ["move_left", "move_right", "move_down", "drop", "rotate_ccw",
"rotate_cw", "cancel"]
func _on_start_pressed():
emit_signal("start")
func _on_quit_pressed():
get_tree().quit()
func _on_instructions_pressed():
var keys = _get_input_keys()
$instructions_popup/instructions_panel/Label.text = INSTRUCTIONS % keys
$instructions_popup.popup()
func _get_input_keys():
var result = []
for input in _inputs:
var input_str
var action_list = InputMap.get_action_list(input)
for a in action_list:
if input_str:
input_str = input_str + ", " + OS.get_scancode_string(a.scancode)
else:
input_str = OS.get_scancode_string(a.scancode)
result.append(input_str)
return result