Posted May 22, 2025 by lovemakeshare
#input #controls #touchscreen #gamepad #controller
The May 18th update slightly broke mobile controls. I want to show you what I had and what I changed to make it work better.
First, the problem. bHopper on mobile uses a virtual joystick, a very helpful prebuilt asset in GDevelop. Testing the latest update, I realized that the player's car would just stop moving.
Here's the event group:
In plain language, here's what's happening:
I realized pretty quickly that my problem was that first condition: The cursor/touch is on TransparentDarkJoystick. On a gamepad, that makes sense. You only need to really deal with input when input is happening. In fact, that's how I do it:
But the difference between a glass touchscreen and a rubberized thumbstick is that on the stick, your finger doesn't slip and slide around. You adhere to the thumbstick. On glass, you can easily slide off. So any time my thumb came off the stick, the cursor/touch is on TransparentDarkJoystick condition was no longer met, so the turning and thrust stopped.
Want to see my brilliant fix?
Yeah, I deleted the cursor/touch condition. That's all I did. Now it's just always applying appropriate rotation and thrust, so my thumb can slide off the virtual joystick and it'll work as intended. I'll likely try to replicate the stick force condition from the gamepad controls on the virtual joystick, just so that I'm not running those events when I don't have to. But the controls feel much better now.
Oh, and I fixed the crummy explosion. I should add more of those.