On screen controls

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

Recently tried to make on screen controls but I ran into an issue
I had four touch screen button with name BtUp, BtDown, BtRight and BtLeft. And I had connected their button_up and button_down to a script.

var down_pressed = false
var ev = InputEventAction.new()

func _process(delta):
	if down_pressed == true:
		ev.action = "ui_down"
		ev.pressed = true

func _on_BtDown_button_down():
	down_pressed = true

func _on_BtDown_button_up():
	down_pressed = false

I had done the same for all the buttons but whenever I press and release any button then It only moves that way but don’t stop.
It prints down_pressed as long I press the key.

:bust_in_silhouette: Reply From: wyattb

You need to set


in the _process() function

It did not worked :frowning:

Help me please | 2021-06-16 07:18

Ah ok. I only tested it with mouse button. Maybe touch is different.

wyattb | 2021-06-16 15:04

Any other solution?

Help me please | 2021-06-17 06:07

Does this help? Seems to be doing what you are doing


wyattb | 2021-06-17 13:08