Android controlls dosn't work

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By reeve
:warning: Old Version Published before Godot 3 was released.

I use the Kinematic Character demo to test the Godot engine at Android. I have modified the player with a CanvasLayer. This Layer has 4 TextureButtons to move, jump and go back to the menu.
At the player script i have changed this 3 lines

var walk_left = Input.is_action_pressed("ui_left")
var walk_right = Input.is_action_pressed("ui_right")
var jump = Input.is_action_pressed("ui_accept")

to this 3 lines

var walk_left = get_node("CanvasLayer/left").is_pressed()
var walk_right = get_node("CanvasLayer/right").is_pressed()
var jump = get_node("CanvasLayer/jump").is_pressed()

The problem is if I test the program at my phone, only one Button works. I can’t walk and jump at the same time. if i push the left Button the other Buttons dosn’t react.
If I push the jump button it is the same. The left or right button dosn’t react.
I can’t use more then one button.
If I use one Button the other Buttons are dead.
How can i make it that the jump and walk buttons work at the same time.

Have you tried with TouchScreenButton instead?

eons | 2017-01-23 10:36

Strange way of doing it.

Try a bunch of if’s in Input process or Fixed process. I assume only one line of your code executes every time, so you can’t get more than one input every iteration. Is also easier to leave out controls that exclude each other with loops like that:

if → “move right”
elif → “move left”
if → “move up”
elif → “move down”

The if statements will capture input at the same time, while elif only happens if the preceding if is false (so you don’t get left and right at the same time, for instance).

I did a quick platformer to test Android deployment, I can share it with you if you want. It’s a bit ugly and looks kinda stupid, but it works. xD

rredesigns | 2017-03-11 05:36

:bust_in_silhouette: Reply From: Edesak

I had same problem try to change button to touchscreen button :slight_smile: should help :slight_smile: