Can anyone help with touch screen on mobile?

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

I have a question about touch screen input on mobile. I have a scene with directional buttons, and the character shoots based on where the screen is touched. How do I make the directional buttons not register as a screen touch for shooting? I am guessing it is something to do with multi touch, but I cannot figure out how to get this to work. Can someone please share example code of this working?

:bust_in_silhouette: Reply From: DodoIta

You can use TouchScreenButton for the movement and simply catch the touchscreen event (for shooting) in the _unhandled_input function:

func _unhandled_input(event):
    if event is InputEventScreenTouch:
        shoot(event.position)

Let me know if this works.