From 3e960a955cf9c7b123c55adaa30bd6b1dc1e6eec Mon Sep 17 00:00:00 2001 From: Vladimir nett00n Budylnikov Date: Fri, 26 Sep 2025 00:57:20 +0400 Subject: [PATCH] exit from game using gamepad --- project.godot | 6 ++++++ scenes/game/game.gd | 5 ++++- scenes/ui/components/ValueStepper.gd | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/project.godot b/project.godot index 626f0be..5061ad7 100644 --- a/project.godot +++ b/project.godot @@ -178,6 +178,12 @@ quit_game={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":true,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194335,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +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(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null) +] +} [internationalization] diff --git a/scenes/game/game.gd b/scenes/game/game.gd index 81b94db..ed8852a 100644 --- a/scenes/game/game.gd +++ b/scenes/game/game.gd @@ -92,7 +92,10 @@ func _on_back_button_pressed() -> void: GameManager.exit_to_main_menu() func _input(event: InputEvent) -> void: - if event.is_action_pressed("action_south") and Input.is_action_pressed("action_north"): + if event.is_action_pressed("ui_back"): + # Handle gamepad/keyboard back action - same as back button + _on_back_button_pressed() + elif event.is_action_pressed("action_south") and Input.is_action_pressed("action_north"): # Debug: Switch to clickomania when primary+secondary actions pressed together if current_gameplay_mode == "match3": set_gameplay_mode("clickomania") diff --git a/scenes/ui/components/ValueStepper.gd b/scenes/ui/components/ValueStepper.gd index 82c7f4b..4f6cab2 100644 --- a/scenes/ui/components/ValueStepper.gd +++ b/scenes/ui/components/ValueStepper.gd @@ -119,7 +119,7 @@ func change_value(direction: int): DebugManager.log_info("Value changed to: " + new_value + " (index: " + str(current_index) + ")", "ValueStepper") ## Override this method for custom value application logic -func _apply_value_change(new_value: String, index: int): +func _apply_value_change(new_value: String, _index: int): match data_source: "language": SettingsManager.set_setting("language", new_value)