basic implementation of input remapping
This commit is contained in:
parent
5f2b3c6d5e
commit
70ef1a8450
5 changed files with 290 additions and 45 deletions
121
autoloads/controls.gd
Normal file
121
autoloads/controls.gd
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
|
const CFG_PATH := "user://controls.pr"
|
||||||
|
const ACTIONS := ["move_left", "move_right", "move_up", "move_down", "jump", "shoot"]
|
||||||
|
const LINKED_ACTIONS := {
|
||||||
|
move_left = "ui_left",
|
||||||
|
move_right = "ui_right",
|
||||||
|
move_up = "ui_up",
|
||||||
|
move_down = "ui_down",
|
||||||
|
jump = "ui_accept",
|
||||||
|
shoot = "ui_cancel",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var cfg := ConfigFile.new()
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
cfg.load(CFG_PATH)
|
||||||
|
_apply_saved_bindings()
|
||||||
|
|
||||||
|
|
||||||
|
func get_key(action: String) -> int:
|
||||||
|
var scancode = cfg.get_value(action, "keyboard")
|
||||||
|
if scancode == null:
|
||||||
|
scancode = _get_default_key(action)
|
||||||
|
return scancode
|
||||||
|
|
||||||
|
|
||||||
|
func get_button(action: String) -> int:
|
||||||
|
var button_index = cfg.get_value(action, "gamepad")
|
||||||
|
if button_index == null:
|
||||||
|
button_index = _get_default_button(action)
|
||||||
|
return button_index
|
||||||
|
|
||||||
|
|
||||||
|
func set_key(action: String, scancode: int) -> void:
|
||||||
|
cfg.set_value(action, "keyboard", scancode)
|
||||||
|
_configure_action_key(action)
|
||||||
|
_save_bindings()
|
||||||
|
|
||||||
|
|
||||||
|
func set_button(action: String, button_index: int) -> void:
|
||||||
|
cfg.set_value(action, "gamepad", button_index)
|
||||||
|
_configure_action_button(action)
|
||||||
|
_save_bindings()
|
||||||
|
|
||||||
|
|
||||||
|
func _save_bindings() -> void:
|
||||||
|
cfg.save(CFG_PATH)
|
||||||
|
|
||||||
|
|
||||||
|
func _apply_saved_bindings() -> void:
|
||||||
|
for action in ACTIONS:
|
||||||
|
_configure_action_key(action)
|
||||||
|
_configure_action_button(action)
|
||||||
|
|
||||||
|
|
||||||
|
func _configure_action_key(action: String) -> void:
|
||||||
|
var scancode = cfg.get_value(action, "keyboard")
|
||||||
|
if scancode == null:
|
||||||
|
scancode = _get_default_key(action)
|
||||||
|
_apply_action_key(action, scancode)
|
||||||
|
var linked_action = LINKED_ACTIONS.get(action)
|
||||||
|
if linked_action:
|
||||||
|
_apply_action_key(linked_action, scancode)
|
||||||
|
|
||||||
|
|
||||||
|
func _configure_action_button(action: String) -> void:
|
||||||
|
var button_index = cfg.get_value(action, "gamepad")
|
||||||
|
if button_index == null:
|
||||||
|
button_index = _get_default_button(action)
|
||||||
|
_apply_action_button(action, button_index)
|
||||||
|
var linked_action = LINKED_ACTIONS.get(action)
|
||||||
|
if linked_action:
|
||||||
|
_apply_action_button(linked_action, button_index)
|
||||||
|
|
||||||
|
|
||||||
|
## applies saved keyboard binding for action
|
||||||
|
func _apply_action_key(action: String, scancode: int) -> void:
|
||||||
|
# erase key and button events
|
||||||
|
for event in InputMap.get_action_list(action):
|
||||||
|
if event is InputEventKey and event.physical_scancode != 0:
|
||||||
|
InputMap.action_erase_event(action, event)
|
||||||
|
# apply keyboard binding
|
||||||
|
var key := InputEventKey.new()
|
||||||
|
key.physical_scancode = scancode
|
||||||
|
key.pressed = true
|
||||||
|
InputMap.action_add_event(action, key)
|
||||||
|
|
||||||
|
|
||||||
|
## applies saved gamepad binding for action
|
||||||
|
func _apply_action_button(action: String, button_index: int) -> void:
|
||||||
|
# erase button events
|
||||||
|
for event in InputMap.get_action_list(action):
|
||||||
|
if event is InputEventJoypadButton:
|
||||||
|
InputMap.action_erase_event(action, event)
|
||||||
|
# apply gamepad binding
|
||||||
|
var button := InputEventJoypadButton.new()
|
||||||
|
button.button_index = button_index
|
||||||
|
button.pressed = true
|
||||||
|
InputMap.action_add_event(action, button)
|
||||||
|
|
||||||
|
|
||||||
|
## get first key input from projectsettings
|
||||||
|
func _get_default_key(action: String) -> int:
|
||||||
|
var events: Array = ProjectSettings.get("input/" + action).events
|
||||||
|
for event in events:
|
||||||
|
if event is InputEventKey:
|
||||||
|
return event.physical_scancode
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
||||||
|
## get first button input from projectsettings
|
||||||
|
func _get_default_button(action: String) -> int:
|
||||||
|
var events: Array = ProjectSettings.get("input/" + action).events
|
||||||
|
for event in events:
|
||||||
|
if event is InputEventJoypadButton:
|
||||||
|
return event.button_index
|
||||||
|
return -1
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=12 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://objects/hud/options_screen_scholar.gd" type="Script" id=1]
|
[ext_resource path="res://objects/hud/options_screen_scholar.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://ui/theme.tres" type="Theme" id=2]
|
[ext_resource path="res://ui/theme.tres" type="Theme" id=2]
|
||||||
|
@ -7,6 +7,8 @@
|
||||||
[ext_resource path="res://graphics/hud/pause_arrow.png" type="Texture" id=5]
|
[ext_resource path="res://graphics/hud/pause_arrow.png" type="Texture" id=5]
|
||||||
[ext_resource path="res://objects/hud/select_border.gd" type="Script" id=6]
|
[ext_resource path="res://objects/hud/select_border.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://objects/hud/labeled_slider.gd" type="Script" id=7]
|
[ext_resource path="res://objects/hud/labeled_slider.gd" type="Script" id=7]
|
||||||
|
[ext_resource path="res://objects/hud/set_keyboard_button.gd" type="Script" id=8]
|
||||||
|
[ext_resource path="res://objects/hud/set_gamepad_button.gd" type="Script" id=9]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id=1]
|
[sub_resource type="ShaderMaterial" id=1]
|
||||||
shader = ExtResource( 4 )
|
shader = ExtResource( 4 )
|
||||||
|
@ -249,6 +251,7 @@ alignment = 1
|
||||||
|
|
||||||
[node name="BorderBackArrow" type="TextureRect" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Video/Border/HBoxContainer"]
|
[node name="BorderBackArrow" type="TextureRect" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Video/Border/HBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
material = SubResource( 1 )
|
material = SubResource( 1 )
|
||||||
margin_left = 30.0
|
margin_left = 30.0
|
||||||
margin_top = 1.0
|
margin_top = 1.0
|
||||||
|
@ -266,6 +269,7 @@ margin_bottom = 10.0
|
||||||
focus_neighbour_left = NodePath(".")
|
focus_neighbour_left = NodePath(".")
|
||||||
focus_neighbour_top = NodePath("../../../FadeSpeed/SelectFadeSpeed")
|
focus_neighbour_top = NodePath("../../../FadeSpeed/SelectFadeSpeed")
|
||||||
focus_neighbour_right = NodePath(".")
|
focus_neighbour_right = NodePath(".")
|
||||||
|
focus_neighbour_bottom = NodePath("../../../Scanlines/SelectScanlines")
|
||||||
theme = ExtResource( 2 )
|
theme = ExtResource( 2 )
|
||||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||||
text = "trans rights"
|
text = "trans rights"
|
||||||
|
@ -273,6 +277,7 @@ script = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="BorderNextArrow" type="TextureRect" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Video/Border/HBoxContainer"]
|
[node name="BorderNextArrow" type="TextureRect" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Video/Border/HBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
material = SubResource( 2 )
|
material = SubResource( 2 )
|
||||||
margin_left = 128.0
|
margin_left = 128.0
|
||||||
margin_top = 1.0
|
margin_top = 1.0
|
||||||
|
@ -296,8 +301,7 @@ unique_name_in_owner = true
|
||||||
margin_left = 74.0
|
margin_left = 74.0
|
||||||
margin_right = 218.0
|
margin_right = 218.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
focus_neighbour_top = NodePath("../../Scaling/SelectScaling")
|
focus_neighbour_top = NodePath("../../Border/HBoxContainer/SelectBorder")
|
||||||
focus_neighbour_bottom = NodePath("../../Border/HBoxContainer/SelectBorder")
|
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
@ -495,6 +499,8 @@ margin_right = 155.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
action = "move_left"
|
||||||
|
|
||||||
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Left"]
|
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Left"]
|
||||||
margin_left = 159.0
|
margin_left = 159.0
|
||||||
|
@ -502,6 +508,8 @@ margin_right = 218.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
action = "move_left"
|
||||||
|
|
||||||
[node name="Right" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
[node name="Right" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
||||||
margin_top = 30.0
|
margin_top = 30.0
|
||||||
|
@ -521,6 +529,8 @@ margin_right = 155.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
action = "move_right"
|
||||||
|
|
||||||
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Right"]
|
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Right"]
|
||||||
margin_left = 159.0
|
margin_left = 159.0
|
||||||
|
@ -528,6 +538,8 @@ margin_right = 218.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
action = "move_right"
|
||||||
|
|
||||||
[node name="Up" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
[node name="Up" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
||||||
margin_top = 44.0
|
margin_top = 44.0
|
||||||
|
@ -547,6 +559,8 @@ margin_right = 155.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
action = "move_up"
|
||||||
|
|
||||||
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Up"]
|
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Up"]
|
||||||
margin_left = 159.0
|
margin_left = 159.0
|
||||||
|
@ -554,6 +568,8 @@ margin_right = 218.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
action = "move_up"
|
||||||
|
|
||||||
[node name="Down" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
[node name="Down" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
||||||
margin_top = 58.0
|
margin_top = 58.0
|
||||||
|
@ -573,6 +589,8 @@ margin_right = 155.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
action = "move_down"
|
||||||
|
|
||||||
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Down"]
|
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Down"]
|
||||||
margin_left = 159.0
|
margin_left = 159.0
|
||||||
|
@ -580,6 +598,8 @@ margin_right = 218.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
action = "move_down"
|
||||||
|
|
||||||
[node name="Jump" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
[node name="Jump" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
||||||
margin_top = 72.0
|
margin_top = 72.0
|
||||||
|
@ -599,6 +619,8 @@ margin_right = 155.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
action = "jump"
|
||||||
|
|
||||||
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Jump"]
|
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Jump"]
|
||||||
margin_left = 159.0
|
margin_left = 159.0
|
||||||
|
@ -606,6 +628,8 @@ margin_right = 218.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
action = "jump"
|
||||||
|
|
||||||
[node name="Attack" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
[node name="Attack" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input"]
|
||||||
margin_top = 86.0
|
margin_top = 86.0
|
||||||
|
@ -625,6 +649,8 @@ margin_right = 155.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
action = "shoot"
|
||||||
|
|
||||||
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Attack"]
|
[node name="Gamepad" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Input/Attack"]
|
||||||
margin_left = 159.0
|
margin_left = 159.0
|
||||||
|
@ -632,6 +658,16 @@ margin_right = 218.0
|
||||||
margin_bottom = 10.0
|
margin_bottom = 10.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "-"
|
text = "-"
|
||||||
|
script = ExtResource( 9 )
|
||||||
|
action = "shoot"
|
||||||
|
|
||||||
|
[node name="DefaultControls" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
|
margin_left = 81.0
|
||||||
|
margin_top = 136.0
|
||||||
|
margin_right = 137.0
|
||||||
|
margin_bottom = 146.0
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "defaults"
|
||||||
|
|
||||||
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/SelectTab" to="." method="_on_tab_selected"]
|
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/SelectTab" to="." method="_on_tab_selected"]
|
||||||
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/Rumble/SelectRumble" to="." method="_on_Rumble_selected"]
|
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/Rumble/SelectRumble" to="." method="_on_Rumble_selected"]
|
||||||
|
|
55
objects/hud/set_gamepad_button.gd
Normal file
55
objects/hud/set_gamepad_button.gd
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
extends Button
|
||||||
|
|
||||||
|
|
||||||
|
const BLINK_SPEED: int = 150
|
||||||
|
|
||||||
|
|
||||||
|
export var action: String
|
||||||
|
|
||||||
|
|
||||||
|
var listen := false
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
connect("pressed", self, "_on_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_update_text()
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if listen:
|
||||||
|
if Time.get_ticks_msec() % (BLINK_SPEED * 2) < BLINK_SPEED:
|
||||||
|
modulate.a = 0.0
|
||||||
|
else:
|
||||||
|
modulate.a = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
func _update_text() -> void:
|
||||||
|
text = str(Controls.get_button(action))
|
||||||
|
modulate.a = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
func _on_pressed() -> void:
|
||||||
|
if not listen:
|
||||||
|
listen = true
|
||||||
|
disabled = true
|
||||||
|
text = ""
|
||||||
|
get_tree().create_timer(2.0, true).connect("timeout", self, "_on_timeout")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_timeout() -> void:
|
||||||
|
listen = false
|
||||||
|
disabled = false
|
||||||
|
_update_text()
|
||||||
|
|
||||||
|
|
||||||
|
func _gui_input(event: InputEvent) -> void:
|
||||||
|
if listen:
|
||||||
|
if event is InputEventJoypadButton and event.pressed:
|
||||||
|
Controls.set_button(action, event.button_index)
|
||||||
|
listen = false
|
||||||
|
set_deferred("disabled", false)
|
||||||
|
_update_text()
|
||||||
|
accept_event()
|
55
objects/hud/set_keyboard_button.gd
Normal file
55
objects/hud/set_keyboard_button.gd
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
extends Button
|
||||||
|
|
||||||
|
|
||||||
|
const BLINK_SPEED: int = 150
|
||||||
|
|
||||||
|
|
||||||
|
export var action: String
|
||||||
|
|
||||||
|
|
||||||
|
var listen := false
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
connect("pressed", self, "_on_pressed")
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_update_text()
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if listen:
|
||||||
|
if Time.get_ticks_msec() % (BLINK_SPEED * 2) < BLINK_SPEED:
|
||||||
|
modulate.a = 0.0
|
||||||
|
else:
|
||||||
|
modulate.a = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
func _update_text() -> void:
|
||||||
|
text = OS.get_scancode_string(Controls.get_key(action))
|
||||||
|
modulate.a = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
func _on_pressed() -> void:
|
||||||
|
if not listen:
|
||||||
|
listen = true
|
||||||
|
disabled = true
|
||||||
|
text = ""
|
||||||
|
get_tree().create_timer(2.0, true).connect("timeout", self, "_on_timeout")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_timeout() -> void:
|
||||||
|
listen = false
|
||||||
|
disabled = false
|
||||||
|
_update_text()
|
||||||
|
|
||||||
|
|
||||||
|
func _gui_input(event: InputEvent) -> void:
|
||||||
|
if listen:
|
||||||
|
if event is InputEventKey and event.pressed:
|
||||||
|
Controls.set_key(action, event.physical_scancode)
|
||||||
|
listen = false
|
||||||
|
set_deferred("disabled", false)
|
||||||
|
_update_text()
|
||||||
|
accept_event()
|
|
@ -79,6 +79,7 @@ config/icon="res://icon.png"
|
||||||
|
|
||||||
Border="*res://autoloads/border.tscn"
|
Border="*res://autoloads/border.tscn"
|
||||||
Audio="*res://autoloads/audio.tscn"
|
Audio="*res://autoloads/audio.tscn"
|
||||||
|
Controls="*res://autoloads/controls.gd"
|
||||||
Options="*res://autoloads/options.gd"
|
Options="*res://autoloads/options.gd"
|
||||||
Save="*res://autoloads/save.gd"
|
Save="*res://autoloads/save.gd"
|
||||||
Game="*res://autoloads/game.gd"
|
Game="*res://autoloads/game.gd"
|
||||||
|
@ -149,20 +150,14 @@ ogg_vorbis={
|
||||||
|
|
||||||
ui_accept={
|
ui_accept={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":88,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":88,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_select={
|
ui_select={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ ]
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":88,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
ui_cancel={
|
ui_cancel={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
|
@ -182,9 +177,10 @@ ui_focus_prev={
|
||||||
}
|
}
|
||||||
ui_left={
|
ui_left={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_right={
|
ui_right={
|
||||||
|
@ -192,6 +188,7 @@ ui_right={
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_up={
|
ui_up={
|
||||||
|
@ -200,6 +197,7 @@ ui_up={
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_down={
|
ui_down={
|
||||||
|
@ -209,6 +207,7 @@ ui_down={
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":7,"axis_value":1.0,"script":null)
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":7,"axis_value":1.0,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_page_up={
|
ui_page_up={
|
||||||
|
@ -256,8 +255,8 @@ debug_move_player={
|
||||||
}
|
}
|
||||||
shoot={
|
shoot={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":90,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
fullscreen={
|
fullscreen={
|
||||||
|
@ -294,27 +293,6 @@ restart={
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
sword={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":67,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
ui_reset={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":67,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
enter_hatch={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
exit_hatch={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
start={
|
start={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
@ -330,27 +308,27 @@ start={
|
||||||
}
|
}
|
||||||
move_left={
|
move_left={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
move_right={
|
move_right={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
move_up={
|
move_up={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
move_down={
|
move_down={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue