0 votes

Hi, I want to move in the UI with Joypad axis but it's bugged (ui_dir every frame when a stick is pressed)

I tryed to control that with something like :

Input.action_press("ui_left")

But the game doesn't detect that. So what I can do to press this action with code?
Sorry for my english and thanks in advance.

in Engine by (16 points)

If you want to move the UI (or cursor) without it moving every frame, have a Timer count down a certain amount of time. For example, whenever the joypad is moved, use a Timer to count down 0.2 or 0.3 seconds. Once the Timer had stopped, allow the joypad to move the UI again.

1 Answer

0 votes

I've never done this, but I saw it in the manual. Don't look at the details, just the way it's done. I took it from here

var local_pos = Vector2(10, 20) # local to Control/Node2D
var ie = InputEventMouseButton.new()
ie.button_index = BUTTON_LEFT
ie.position = get_viewport_transform() * (get_global_transform() * local_pos)
get_tree().input_event(ie)
by (714 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.