0 votes

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.

in Engine by (19 points)

2 Answers

0 votes
Best answer

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

by (19 points)
+1 vote

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: https://drive.google.com/open?id=1U7GeLmI-FQGqjdj3W_YdfipmiSsRJw_o

by (28 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.