Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
/claim #257
Problem Overview
The "Move with Player 1/2" block currently only works with keyboard inputs (e.g., WASD keys and arrow keys).
The goal is to extend this functionality so that the block can also work with gamepad inputs (such as analog stick movements or D-pad buttons) to allow for more flexible control options, especially for users who prefer using a gamepad.
2. Solution Overview
The solution likely involves modifying the existing block logic to incorporate gamepad support. Here's how that could have been done:
Input Type Handling: A new input_type parameter or method is added, which allows the system to determine whether the inputs should come from the keyboard or gamepad.
Gamepad Input Mapping: The standard Godot input system can be used to map gamepad buttons and analog stick movements. In Godot, the Input class can be used to detect gamepad inputs, such as:
D-pad or Analog Stick: Detect movement from the analog sticks or D-pad.
Gamepad Buttons: Detect button presses (e.g., A, B, X, Y on controllers).
Controller Input Logic: The code in the move_with_player_buttons method would be updated to check for gamepad inputs in addition to keyboard inputs, possibly by using Input.get_joy_axis() for joystick movement or Input.is_joy_button_pressed() for button presses.