Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | fagnerln |
I created a small script for move an Area2d on a grid, I want that the player taps the direction they want to move. If I control it at the keyboard it works flawlessly but for some reason, on the gamepad it execute two times I have no idea why:
const TILE_SIZE = 64
func _input(event):
if Input.is_action_just_pressed("ui_up"):
move_cursor( 0 , -1 )
elif Input.is_action_just_pressed("ui_down"):
move_cursor( 0 , 1 )
elif Input.is_action_just_pressed("ui_left"):
move_cursor( -1 , 0 )
elif Input.is_action_just_pressed("ui_right"):
move_cursor( 1 , 0 )
func move_cursor(x , y):
cursor.position += Vector2(x , y) * TILE_SIZE
cursor.pos += Vector2(x , y)
So I tried:
if Input.is_action_pressed("ui_up") and not event.is_echo():
and (I don’t think that make difference):
if Input.is_action_just_pressed("ui_up") and not event.is_echo():
and:
if Input.is_action_just_pressed("ui_up") and event.is_pressed():
In every scenario the keyboard works well, I didn’t changed anything on the input map as it just a prototype, ui_up for example is up on the keyboard and d-pad up.
I’m on linux, using a X360 gamepad
Maybe I should create a Issue on their github or maybe on SDL?
For future reference, this was cross-posted to GitHub: My gamepad d-pad is executing is_action_just_pressed twice · Issue #45443 · godotengine/godot · GitHub
Calinou | 2021-01-25 17:25