0 votes


I noticed that pressing a key and a spacebar prevents engine from receiving input from another one. It seems to be some kind of a deeper problem, as it persists even in official demos like "Simple Shooter".
For example: Pressing space, left arrow and then upper arrow will move the spaceship left but not up until spacebar is released. Removing spacebar for input mappings doesn't solve it.

Is this an known issue and how to go around it? I don't think not using spacebar is the solution. Could it be that movement code from the demos is not a fully functional approach?

Here it is for reference:

 if Input.is_action_pressed("up"):
      #do stuff
 if Input.is_action_pressed("down"):
      #do stuff
 if Input.is_action_pressed("left"):
      #do stuff
 if Input.is_action_pressed("right"):
      #do stuff

If so how to do it properly? Thank you.

in Engine by (39 points)

Do you have this problem if you poll input directly with Input.is_key_pressed(KEY_SPACE) etc?

Yes I do. Just checked, no doubt.

What is your OS? Which Godot version? I know that some keyboards have a limit on the number of keys you can press at the same time.

I tested this in Godot 2.1.3:

func _process(delta):
    var keys = ""
    if Input.is_key_pressed(KEY_LEFT):
        keys += "L"
    if Input.is_key_pressed(KEY_RIGHT):
        keys += "R"
    if Input.is_key_pressed(KEY_UP):
        keys += "U"
    if Input.is_key_pressed(KEY_DOWN):
        keys += "D"
    if Input.is_key_pressed(KEY_SPACE):
        keys += "S"

All keys registered correctly, even if I press them all.
Also make sure you really mean "real" input, because if you deduce this by looking at character movement in the game, then it could simply be that one if blocks simply takes over the state decided in the previous if block, which is not a Godot bug but a game "bug".

Win 7 x64 - Godot 2.1.4.
Tested your code. It won't register certain combinations. It's really strange.
For example:
Right + Up + Space works
Left + Up + Space doesn't
But if during this combination, I switch from holding Right to holding Left key, it will still register R + U + S until I release one of the keys.

Your keys work in the keyboard test application on this page?


If not, is ghosting.

I finally read your reply. Thank you very much. Quite fascinating. Problem solved.

Is something really annoying on the developer side because you do not know how good or bad will be the average keyboard of the players.

An option is to allow key configuration and add support for gamepads (is a plus for accessibility).

1 Answer

0 votes
Best answer

Seems to be a case of ghosting. Problem was on my end.

by (39 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 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 webmaster@godotengine.org with your username.