mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-21 23:18:11 +00:00
added in pause button rebinding
This commit is contained in:
@@ -39,7 +39,7 @@ script/source = "extends Node
|
||||
|
||||
var input_nodes := []
|
||||
|
||||
var actions := [\"jump\", \"run\", \"action\", \"move_left\", \"move_right\", \"move_up\", \"move_down\", \"ui_accept\", \"ui_back\"]
|
||||
var actions := [\"jump\", \"run\", \"action\", \"move_left\", \"move_right\", \"move_up\", \"move_down\", \"ui_accept\", \"ui_back\", \"pause\"]
|
||||
|
||||
@export_enum(\"Keyboard\", \"Controller\") var type := 0
|
||||
|
||||
@@ -88,7 +88,7 @@ func update_starting_values() -> void:
|
||||
func save_inputs() -> void:
|
||||
for i in actions:
|
||||
var event = null
|
||||
if i.contains(\"ui\"):
|
||||
if i.contains(\"ui\") or i == \"pause\":
|
||||
event = InputMap.action_get_events(i)[type]
|
||||
else:
|
||||
event = InputMap.action_get_events(i + \"_0\")[type]
|
||||
@@ -687,7 +687,7 @@ 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"), NodePath("Accept"), NodePath("Back")]
|
||||
options = [NodePath("Jump"), NodePath("Run"), NodePath("Action"), NodePath("Left"), NodePath("Right"), NodePath("Up"), NodePath("Down"), NodePath("Accept"), NodePath("Back"), NodePath("Pause")]
|
||||
|
||||
[node name="Control" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls"]
|
||||
custom_minimum_size = Vector2(0, 4)
|
||||
@@ -738,6 +738,11 @@ layout_mode = 2
|
||||
action_names = ["ui_back"]
|
||||
title = "BACK"
|
||||
|
||||
[node name="Pause" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
action_names = ["pause"]
|
||||
title = "PAUSE"
|
||||
|
||||
[node name="InputMapSaving" type="Node" parent="PanelContainer/MarginContainer/VBoxContainer/KeyboardControls" groups=["Options"]]
|
||||
process_mode = 3
|
||||
script = SubResource("GDScript_ksnto")
|
||||
@@ -755,7 +760,7 @@ 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"), NodePath("Accept"), NodePath("Back")]
|
||||
options = [NodePath("Jump"), NodePath("Run"), NodePath("Action"), NodePath("Left"), NodePath("Right"), NodePath("Up"), NodePath("Down"), NodePath("Accept"), NodePath("Back"), NodePath("Pause")]
|
||||
|
||||
[node name="Control" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/Controller"]
|
||||
custom_minimum_size = Vector2(0, 4)
|
||||
@@ -824,6 +829,13 @@ action_names = ["ui_back"]
|
||||
title = "BACK"
|
||||
type = 1
|
||||
|
||||
[node name="Pause" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"] instance=ExtResource("9_ksnto")]
|
||||
layout_mode = 2
|
||||
settings_category = "controller"
|
||||
action_names = ["pause"]
|
||||
title = "PAUSE"
|
||||
type = 1
|
||||
|
||||
[node name="InputMapSaving" type="Node" parent="PanelContainer/MarginContainer/VBoxContainer/Controller" groups=["Options"]]
|
||||
script = SubResource("GDScript_ksnto")
|
||||
type = 1
|
||||
|
@@ -36,7 +36,8 @@ var file := {
|
||||
"move_up": "Up",
|
||||
"move_down": "Down",
|
||||
"ui_accept": "Z",
|
||||
"ui_back": "X"
|
||||
"ui_back": "X",
|
||||
"pause": "Escape"
|
||||
},
|
||||
"controller":
|
||||
{
|
||||
@@ -48,7 +49,8 @@ var file := {
|
||||
"move_up": "1,-1",
|
||||
"move_down": "1,1",
|
||||
"ui_accept": 0,
|
||||
"ui_back": 1
|
||||
"ui_back": 1,
|
||||
"pause": 6
|
||||
},
|
||||
"visuals":
|
||||
{
|
||||
|
@@ -75,10 +75,10 @@ func _input(event: InputEvent) -> void:
|
||||
if event.is_pressed() == false:
|
||||
return
|
||||
|
||||
if event is InputEventKey:
|
||||
if event.as_text_physical_keycode() == "Escape":
|
||||
cancel_remap()
|
||||
return
|
||||
#if event is InputEventKey:
|
||||
#if event.as_text_physical_keycode() == "Escape":
|
||||
#cancel_remap()
|
||||
#return
|
||||
|
||||
if type == 0 and event is InputEventKey:
|
||||
map_event_to_action(event)
|
||||
@@ -90,7 +90,7 @@ func _input(event: InputEvent) -> void:
|
||||
func map_event_to_action(event) -> void:
|
||||
for action_name in action_names:
|
||||
var action = action_name
|
||||
if action.contains("ui_") == false:
|
||||
if action.contains("ui_") == false and action != "pause":
|
||||
action = action_name + "_" + str(player_idx)
|
||||
var events = InputMap.action_get_events(action).duplicate()
|
||||
events[type] = event
|
||||
|
@@ -212,7 +212,7 @@ move_up_0={
|
||||
}
|
||||
pause={
|
||||
"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":4194305,"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":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user