mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
you can now bind UI / Menu options to keys in the settings
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://bflpf2fdtbgkt"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bflpf2fdtbgkt"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://w6t6q5vfow5p" path="res://Scripts/UI/SelectableInputOptionNode.gd" id="1_74gxt"]
|
||||
[ext_resource type="Texture2D" uid="uid://3p2l7rec0gh5" path="res://Assets/Sprites/UI/Cursor.png" id="2_voltx"]
|
||||
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_voltx"]
|
||||
[ext_resource type="JSON" path="res://Assets/Sprites/UI/Cursor.json" id="4_q1ixt"]
|
||||
[ext_resource type="Script" uid="uid://co6tjg3w6qpd8" path="res://Scripts/Parts/LabelFontChanger.gd" id="5_voltx"]
|
||||
[ext_resource type="Resource" uid="uid://8dcuxbc3h2u2" path="res://Resources/ThemedResources/Font.tres" id="6_q1ixt"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qti1l"]
|
||||
atlas = ExtResource("2_voltx")
|
||||
@@ -47,7 +46,6 @@ one_shot = true
|
||||
[node name="LabelFontChanger" type="Node" parent="." node_paths=PackedStringArray("labels")]
|
||||
script = ExtResource("5_voltx")
|
||||
labels = [NodePath("../Title"), NodePath("../Value")]
|
||||
resource = ExtResource("6_q1ixt")
|
||||
metadata/_custom_type_script = "uid://co6tjg3w6qpd8"
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="cancel_remap"]
|
||||
|
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c6t324yc5gx7p"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://c6t324yc5gx7p"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cp4040k6fqwow" path="res://Scripts/Classes/Entities/TeleportPipeArea.gd" id="1_40l7q"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8yio3lpcsvqu" path="res://Assets/Sprites/UI/PipeArrow.png" id="2_fkbuh"]
|
||||
[ext_resource type="Script" uid="uid://cpwloakvp672a" path="res://Scripts/Parts/EditorVisibleNode.gd" id="3_40l7q"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lv0oh"]
|
||||
size = Vector2(16, 16)
|
||||
@@ -39,6 +40,7 @@ position = Vector2(0, 32)
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="."]
|
||||
position = Vector2(-3.496911e-07, 8)
|
||||
script = ExtResource("3_40l7q")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="Node2D"]
|
||||
use_top_left = true
|
||||
|
@@ -1,10 +1,12 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://4gxhnql5bjk6"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://4gxhnql5bjk6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://50hm4xgnw8ks" path="res://Assets/Sprites/Tilesets/Tracks.png" id="1_84p4k"]
|
||||
[ext_resource type="Script" uid="uid://chhr6kgvstkod" path="res://Scripts/Classes/Entities/Objects/TrackPiece.gd" id="1_t2c2l"]
|
||||
[ext_resource type="Texture2D" uid="uid://barofu3g8jf00" path="res://Assets/Sprites/Tilesets/InvisibleTracks.png" id="2_5cc87"]
|
||||
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_4ie33"]
|
||||
[ext_resource type="JSON" path="res://Assets/Sprites/Tilesets/Track.json" id="4_5cc87"]
|
||||
[ext_resource type="Script" uid="uid://cpwloakvp672a" path="res://Scripts/Parts/EditorVisibleNode.gd" id="6_yu1nf"]
|
||||
[ext_resource type="Texture2D" uid="uid://dp4b0cpisp5cs" path="res://Assets/Sprites/UI/Arrow.png" id="7_br4q4"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4k6gi"]
|
||||
size = Vector2(12, 12)
|
||||
@@ -203,6 +205,16 @@ mode = 1
|
||||
resource_json = ExtResource("4_5cc87")
|
||||
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
|
||||
|
||||
[node name="DirectionArrow" type="Node2D" parent="."]
|
||||
script = ExtResource("6_yu1nf")
|
||||
metadata/_custom_type_script = "uid://cpwloakvp672a"
|
||||
|
||||
[node name="Arrow" type="Sprite2D" parent="DirectionArrow"]
|
||||
modulate = Color(0, 1, 1, 1)
|
||||
rotation = -1.5707964
|
||||
texture = ExtResource("7_br4q4")
|
||||
hframes = 2
|
||||
|
||||
[connection signal="mouse_entered" from="PlacePreview/NW/MouseArea" to="." method="on_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="PlacePreview/NW/MouseArea" to="." method="on_mouse_exited"]
|
||||
[connection signal="mouse_entered" from="PlacePreview/N/MouseArea" to="." method="on_mouse_entered" binds= [1]]
|
||||
|
@@ -39,7 +39,7 @@ script/source = "extends Node
|
||||
|
||||
var input_nodes := []
|
||||
|
||||
var actions := [\"jump\", \"run\", \"action\", \"move_left\", \"move_right\", \"move_up\", \"move_down\"]
|
||||
var actions := [\"jump\", \"run\", \"action\", \"move_left\", \"move_right\", \"move_up\", \"move_down\", \"ui_accept\", \"ui_back\"]
|
||||
|
||||
@export_enum(\"Keyboard\", \"Controller\") var type := 0
|
||||
|
||||
@@ -53,33 +53,45 @@ func get_input_nodes() -> void:
|
||||
if i is SelectableInputOption:
|
||||
input_nodes.append(i)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed(\"ui_reset_keybindings\"):
|
||||
InputMap.load_from_project_settings()
|
||||
save_inputs()
|
||||
Settings.save_settings()
|
||||
load_inputs()
|
||||
|
||||
func load_inputs() -> void:
|
||||
for i in input_nodes:
|
||||
var action = i.action_name
|
||||
var value = Settings.file[[\"keyboard\", \"controller\"][type]].get(action, null)
|
||||
var event: InputEvent = null
|
||||
if value == null:
|
||||
continue
|
||||
if type == 0:
|
||||
event = InputEventKey.new()
|
||||
event.keycode = OS.find_keycode_from_string(value)
|
||||
elif type == 1:
|
||||
if value is String:
|
||||
var array = value.split(\",\")
|
||||
event = InputEventJoypadMotion.new()
|
||||
event.axis = int(array[0])
|
||||
event.axis_value = int(array[1])
|
||||
elif value is int:
|
||||
event = InputEventJoypadButton.new()
|
||||
event.button_index = value
|
||||
i.map_event_to_action(event)
|
||||
for action_name in i.action_names:
|
||||
var action = action_name
|
||||
var value = Settings.file[[\"keyboard\", \"controller\"][type]].get(action, null)
|
||||
var event: InputEvent = null
|
||||
if value == null:
|
||||
continue
|
||||
if type == 0:
|
||||
event = InputEventKey.new()
|
||||
event.keycode = OS.find_keycode_from_string(value)
|
||||
elif type == 1:
|
||||
if value is String:
|
||||
var array = value.split(\",\")
|
||||
event = InputEventJoypadMotion.new()
|
||||
event.axis = int(array[0])
|
||||
event.axis_value = int(array[1])
|
||||
elif value is int:
|
||||
event = InputEventJoypadButton.new()
|
||||
event.button_index = value
|
||||
i.map_event_to_action(event)
|
||||
|
||||
func update_starting_values() -> void:
|
||||
load_inputs()
|
||||
|
||||
func save_inputs() -> void:
|
||||
for i in actions:
|
||||
var event = InputMap.action_get_events(i + \"_0\")[type]
|
||||
var event = null
|
||||
if i.contains(\"ui\"):
|
||||
event = InputMap.action_get_events(i)[type]
|
||||
else:
|
||||
event = InputMap.action_get_events(i + \"_0\")[type]
|
||||
var rep
|
||||
if event is InputEventKey:
|
||||
rep = OS.get_keycode_string(event.keycode)
|
||||
@@ -87,6 +99,8 @@ func save_inputs() -> void:
|
||||
rep = event.button_index
|
||||
elif event is InputEventJoypadMotion:
|
||||
rep = str(event.axis) + \",\" + str(event.axis_value)
|
||||
else:
|
||||
pass
|
||||
Settings.file[[\"keyboard\", \"controller\"][type]][i] = rep
|
||||
"
|
||||
|
||||
@@ -668,12 +682,12 @@ uppercase = true
|
||||
script = ExtResource("10_2qqpf")
|
||||
|
||||
[node name="KeyboardControls" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer" node_paths=PackedStringArray("options")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = -4
|
||||
script = ExtResource("4_avtty")
|
||||
category_name = "SETTINGS_KEYBOARD"
|
||||
options = [NodePath("Jump"), NodePath("Run"), NodePath("Action"), NodePath("Left"), NodePath("Right"), NodePath("Up"), NodePath("Down")]
|
||||
options = [NodePath("Jump"), NodePath("Run"), NodePath("Action"), NodePath("Left"), NodePath("Right"), NodePath("Up"), NodePath("Down"), NodePath("Accept"), NodePath("Back")]
|
||||
|
||||
[node name="Control" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls"]
|
||||
custom_minimum_size = Vector2(0, 4)
|
||||
@@ -681,49 +695,67 @@ layout_mode = 2
|
||||
|
||||
[node name="Jump" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_name = "jump"
|
||||
action_names = ["jump"]
|
||||
title = "ACTION_JUMP"
|
||||
|
||||
[node name="Run" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_name = "run"
|
||||
action_names = ["run"]
|
||||
title = "ACTION_RUN"
|
||||
|
||||
[node name="Action" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_name = "action"
|
||||
action_names = ["action"]
|
||||
title = "ACTION_ACTION"
|
||||
|
||||
[node name="Left" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_name = "move_left"
|
||||
action_names = ["move_left", "ui_left"]
|
||||
title = "ACTION_LEFT"
|
||||
|
||||
[node name="Right" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_name = "move_right"
|
||||
action_names = ["move_right", "ui_right"]
|
||||
title = "ACTION_RIGHT"
|
||||
|
||||
[node name="Up" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_name = "move_up"
|
||||
action_names = ["move_up", "ui_up"]
|
||||
title = "ACTION_UP"
|
||||
|
||||
[node name="Down" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_name = "move_down"
|
||||
action_names = ["move_down", "ui_down"]
|
||||
title = "ACTION_DOWN"
|
||||
|
||||
[node name="Accept" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_names = ["ui_accept"]
|
||||
title = "ACCEPT"
|
||||
|
||||
[node name="Back" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_names = ["ui_back"]
|
||||
title = "BACK"
|
||||
|
||||
[node name="InputMapSaving" type="Node" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"]]
|
||||
process_mode = 3
|
||||
script = SubResource("GDScript_ksnto")
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 10
|
||||
text = "PRESS F5 TO RESET BINDINGS."
|
||||
uppercase = true
|
||||
|
||||
[node name="Controller" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer" node_paths=PackedStringArray("options")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = -4
|
||||
script = ExtResource("4_avtty")
|
||||
category_name = "SETTINGS_CONTROLLER"
|
||||
options = [NodePath("Jump"), NodePath("Run"), NodePath("Action"), NodePath("Left"), NodePath("Right"), NodePath("Up"), NodePath("Down")]
|
||||
options = [NodePath("Jump"), NodePath("Run"), NodePath("Action"), NodePath("Left"), NodePath("Right"), NodePath("Up"), NodePath("Down"), NodePath("Accept"), NodePath("Back")]
|
||||
|
||||
[node name="Control" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/Controller"]
|
||||
custom_minimum_size = Vector2(0, 4)
|
||||
@@ -732,57 +764,78 @@ layout_mode = 2
|
||||
[node name="Jump" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_name = "jump"
|
||||
action_names = ["jump"]
|
||||
title = "ACTION_JUMP"
|
||||
type = 1
|
||||
|
||||
[node name="Run" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_name = "run"
|
||||
action_names = ["run"]
|
||||
title = "ACTION_RUN"
|
||||
type = 1
|
||||
|
||||
[node name="Action" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_name = "action"
|
||||
action_names = ["action"]
|
||||
title = "ACTION_ACTION"
|
||||
type = 1
|
||||
|
||||
[node name="Left" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_name = "move_left"
|
||||
action_names = ["move_left", "ui_left"]
|
||||
title = "ACTION_LEFT"
|
||||
type = 1
|
||||
|
||||
[node name="Right" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_name = "move_right"
|
||||
action_names = ["move_right", "ui_right"]
|
||||
title = "ACTION_RIGHT"
|
||||
type = 1
|
||||
|
||||
[node name="Up" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_name = "move_up"
|
||||
action_names = ["move_up", "ui_up"]
|
||||
title = "ACTION_UP"
|
||||
type = 1
|
||||
|
||||
[node name="Down" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_name = "move_down"
|
||||
action_names = ["move_down", "ui_down"]
|
||||
title = "ACTION_DOWN"
|
||||
type = 1
|
||||
|
||||
[node name="Accept" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_names = ["ui_accept"]
|
||||
title = "ACCEPT"
|
||||
type = 1
|
||||
|
||||
[node name="Back" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_names = ["ui_back"]
|
||||
title = "BACK"
|
||||
type = 1
|
||||
|
||||
[node name="InputMapSaving" type="Node" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"]]
|
||||
script = SubResource("GDScript_ksnto")
|
||||
type = 1
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Controller"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 10
|
||||
text = "PRESS F5 TO RESET BINDINGS."
|
||||
uppercase = true
|
||||
|
||||
[node name="Data" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer" node_paths=PackedStringArray("options")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = -4
|
||||
script = ExtResource("4_avtty")
|
||||
|
@@ -49,6 +49,7 @@ func update_direction_textures() -> void:
|
||||
i.frame = int(Track.DIRECTIONS[i.get_index()] == starting_direction)
|
||||
for i in [$Start, $Connect, $End]:
|
||||
i.texture = texture
|
||||
$DirectionArrow.global_rotation = Vector2(connecting_direction).angle()
|
||||
|
||||
func on_mouse_entered(area_idx := 0) -> void:
|
||||
mouse_in_areas |= (1 << area_idx)
|
||||
|
@@ -20,7 +20,7 @@ func update_visuals() -> void:
|
||||
func run_player_check(player: Player) -> void:
|
||||
if Global.player_action_pressed(get_input_direction(enter_direction), player.player_id) and can_enter:
|
||||
can_enter = false
|
||||
Checkpoint.passed = false
|
||||
Checkpoint.passed_checkpoints.clear()
|
||||
player.enter_pipe(self, false)
|
||||
await get_tree().create_timer(1, false).timeout
|
||||
$CanvasLayer.show()
|
||||
|
@@ -34,7 +34,9 @@ var file := {
|
||||
"move_left": "Left",
|
||||
"move_right": "Right",
|
||||
"move_up": "Up",
|
||||
"move_down": "Down"
|
||||
"move_down": "Down",
|
||||
"ui_accept": "Z",
|
||||
"ui_back": "X"
|
||||
},
|
||||
"controller":
|
||||
{
|
||||
@@ -44,7 +46,9 @@ var file := {
|
||||
"move_left": "0,-1",
|
||||
"move_right": "0,1",
|
||||
"move_up": "1,-1",
|
||||
"move_down": "1,1"
|
||||
"move_down": "1,1",
|
||||
"ui_accept": 0,
|
||||
"ui_back": 1
|
||||
},
|
||||
"visuals":
|
||||
{
|
||||
|
@@ -25,7 +25,7 @@ func _exit_tree() -> void:
|
||||
Global.get_node("GameHUD").show()
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("jump_0") and can_skip:
|
||||
if Input.is_action_just_pressed("ui_accept") and can_skip:
|
||||
go_to_menu()
|
||||
|
||||
func go_to_menu() -> void:
|
||||
|
@@ -2,6 +2,7 @@ class_name LevelEditorVisibleNode
|
||||
extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
update()
|
||||
if Global.level_editor != null:
|
||||
Global.level_editor.editor_start.connect(update)
|
||||
|
@@ -4,7 +4,7 @@ extends HBoxContainer
|
||||
@export var settings_category := "video"
|
||||
@export var selected := false
|
||||
|
||||
@export var action_name := ""
|
||||
@export var action_names := [""]
|
||||
@export var title := ""
|
||||
|
||||
@export_enum("Keyboard", "Controller") var type := 0
|
||||
@@ -42,10 +42,15 @@ const button_id_translation := [
|
||||
"DPad R"
|
||||
]
|
||||
|
||||
func _ready() -> void:
|
||||
update_value()
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if selected:
|
||||
handle_inputs()
|
||||
$Cursor.modulate.a = int(selected)
|
||||
|
||||
func update_value() -> void:
|
||||
$Title.text = tr(title) + ":"
|
||||
$Value.text = get_event_string(input_event) if not awaiting_input else "Press Any..."
|
||||
|
||||
@@ -62,6 +67,7 @@ func begin_remap() -> void:
|
||||
get_parent().can_input = false
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
awaiting_input = true
|
||||
update_value()
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if awaiting_input == false: return
|
||||
@@ -82,23 +88,28 @@ func _input(event: InputEvent) -> void:
|
||||
map_event_to_action(event)
|
||||
|
||||
func map_event_to_action(event) -> void:
|
||||
var action = action_name + "_" + str(player_idx)
|
||||
var events = InputMap.action_get_events(action).duplicate()
|
||||
events[type] = event
|
||||
InputMap.action_erase_events(action)
|
||||
for i in events:
|
||||
InputMap.action_add_event(action, i)
|
||||
input_changed.emit(action, event)
|
||||
input_event = event
|
||||
awaiting_input = false
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
rebinding_input = false
|
||||
get_parent().can_input = true
|
||||
can_remap = true
|
||||
for action_name in action_names:
|
||||
var action = action_name
|
||||
if action.contains("ui_") == false:
|
||||
action = action_name + "_" + str(player_idx)
|
||||
var events = InputMap.action_get_events(action).duplicate()
|
||||
events[type] = event
|
||||
InputMap.action_erase_events(action)
|
||||
for i in events:
|
||||
InputMap.action_add_event(action, i)
|
||||
input_changed.emit(action, event)
|
||||
input_event = event
|
||||
awaiting_input = false
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
rebinding_input = false
|
||||
get_parent().can_input = true
|
||||
can_remap = true
|
||||
update_value()
|
||||
|
||||
func get_event_string(event: InputEvent) -> String:
|
||||
var event_string := ""
|
||||
if event is InputEventKey:
|
||||
print(event.keycode)
|
||||
event_string = OS.get_keycode_string(event.keycode)
|
||||
elif event is InputEventJoypadButton:
|
||||
var translation = button_id_translation[event.button_index]
|
||||
@@ -126,6 +137,8 @@ func get_event_string(event: InputEvent) -> String:
|
||||
else:
|
||||
direction = "Down"
|
||||
event_string = stick + " " + direction
|
||||
else:
|
||||
pass
|
||||
return event_string
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
|
@@ -128,10 +128,8 @@ wav={
|
||||
|
||||
ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":90,"physical_keycode":0,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_select={
|
||||
@@ -149,74 +147,66 @@ ui_cancel={
|
||||
ui_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":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":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":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(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"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(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":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(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":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
jump_0={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":90,"physical_keycode":0,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
run_0={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":88,"physical_keycode":0,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
action_0={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":88,"physical_keycode":0,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_left_0={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_right_0={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_down_0={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_up_0={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
@@ -484,9 +474,7 @@ editor_paste={
|
||||
}
|
||||
ui_back={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194308,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":88,"physical_keycode":0,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
@@ -495,6 +483,11 @@ pick_tile={
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_reset_keybindings={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194336,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[internationalization]
|
||||
|
||||
|
Reference in New Issue
Block a user