Why does Input.is_action_pressed seem to miss continous key presses?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dragonmantank

I am following along with a tutorial, and as part of the general control loop it has this block to determine what direction we need to move based on the arrow keys:

var LEFT = Input.is_action_pressed("ui_left")
var RIGHT = Input.is_action_pressed("ui_right")
var UP = Input.is_action_pressed("ui_up")
var DOWN = Input.is_action_pressed("ui_down")

movedir.x = -int(LEFT) + int(RIGHT)
movedir.y = -int(UP) + int(DOWN)

If I hold down one of the buttons, say the right arrow, this works for about a full second of a press before it seems to stop registering the keypress, and every loop it detects then drops the keypress. I added the following to check what movedir is being set to:

print(movedir)

I get the following output in my console

(1, 0)  // About a full second of a bunch of these, then the looping
(0, 0)
(1, 0)
(0, 0)
(1, 0)
(0, 0)
(1, 0)
(0, 0)
(1, 0)
(0, 0)
(1, 0)

It seems like the keypress is just stopping being registered, and then immediately picked back up.

I’m running Fedora 28 with GNOME Classic, and have tried 3.0.4.stable.fedora and 3.0.6.stable directly from the website, and both versions cause the stuttering.

:bust_in_silhouette: Reply From: alpinus4

For me everything works fine.

enter image description here

extends KinematicBody2D

var movedir = Vector2()
export var SPEED = 100

func _process(delta):
var LEFT = Input.is_action_pressed("ui_left")
var RIGHT = Input.is_action_pressed("ui_right")
var UP = Input.is_action_pressed("ui_up")
var DOWN = Input.is_action_pressed("ui_down")

movedir.x = -int(LEFT) + int(RIGHT)
movedir.y = -int(UP) + int(DOWN)
print(movedir)

movedir = movedir* delta * SPEED

move_and_collide(movedir)

Output in console:


(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, 0)
(-1, -1)
(-1, -1)
(-1, -1)
(-1, -1)
(-1, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(0, -1)
(1, -1)
(1, -1)
(1, -1)
(1, -1)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)
(1, 0)

I’m using Ubuntu 18.04 Budgie and as you Godot 3.06.stable.
My project folder: tests.zip - Google Drive

:bust_in_silhouette: Reply From: dragonmantank

Turns out it was Synergy causing problems. I disabled it and that removed the stutter.