[Solved] Why does the button stick on mobile devices?

The jump button always sticks whenever I test it on Android phones (I have 3 different smartphone models). It unsticks when I tap anywhere else on the screen. The code is below. The reason I change the animation is so the button will change color when the player taps on it. Is there something wrong with my code?

I’ve never made mobile controls before, but…
Try “A new touch has started”? If that’s not enough, consider Touch X Position and Touch Y conditions, and make them check if the touch coordinates > jumpButton.X() and also touch coordinates < jumpButton.X() + jumpButton.Width(). Same for Y axis. But it will get messy…
Corrections are welcome, thank you!

The problem might be the same as Platformer example, where the jump button is active as long mouse cursor on it, even if not clicked. In other words, the cursor/touch is at the same position (at jump button) until you tap somewhere else.

1 Like

I couldn’t get it to unstick, but I figured out if I make the jump button go back to normal when the character is On Floor that solves it.

1 Like

The problem is that touch is like moving the cursor and clicking. So you are moving the cursor to the button, and as long as you don’t press somewhere else, the cursor remains there.
You should use a clicking condition, not only a cursor position condition.

1 Like

I fixed it by adding a “New Touch Has Started” condition.

2 Likes

Try this extention

1 Like