How to differentiate touchscreen button press and a normal touch screen press.

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

Basically I have three separate touch screen buttons. Two are directions and one is jump. I want to be able to have a tap action that does something that has nothing to do with those three options. Ive tried having event.pressed and a boolean but half the time nothing is called. I have been using unhandled input that doesn’t work.

Not sure I follow what you’re trying to achieve here; a tap on an existing button versus hold? I think there’s a button event for that. Or is this a tap unrelated to the buttons? I think I’d just have another control that consumes all unhandled input, if that makes sense. The buttons handle their own actions and anything else is consumed by a parent control that responds to everything else.

spaceyjase | 2023-04-15 10:02

I have this if(InputEventScreenTouch and event.is_pressed()): in undhandled_input. But whenever I click a TouchScreenButton, it still gets called. Which unhandled_input shouldn’t allow. I’m just lost on it.

GloopCompost | 2023-04-15 16:41

This may also depends on your scene tree and mouse filter. This example world for me:

Root
    GameScene
    UI Scene
        UI Button

Button clicks stop at the button while unhandled events make it to the game scene. There’s an explanation in the docs here that may help: Using InputEvent — Godot Engine (stable) documentation in English. Perhaps try on a small test scene to simplify and reproduce.

spaceyjase | 2023-04-15 19:12