Pressing 2 touchscreen buttons at same time?

I have a game I’m designing on mobile. There is a D-pad to control the player’s movement (right side), and a jump button (left side).
I’ve programmed both controls like so: “if cursor in on object” + “left mouse pressed” = do action. Which works perfect, except when I press both at the same time.
When the player runs right or left and presses the jump button at the same time the player stops in mid-air and doesn’t keep moving through the jump as the right or left d-pad is being held. How do I program it so I can press both buttons at the same time?
Here’s a YouTube video of the game in action for reference: Gdevelop help- pressing 2 touchscreen buttons at same time? - YouTube

You’ll need to use the multitouch actions and conditions.

Here’s the GDevelop example project for it.

1 Like

Thanks for pointing me to the new touch functions. I tried a few setups and couldn’t get the D-pad to work :frowning:

I tried: “If cursor/touch is on an object (right pad)” and “A new touch has started” then do action.

  • But it only moved the player 1 pixel. So I assume that only triggers in 1 frame.

Then I tried: “If cursor/touch is on an object (right pad)” and “A touch has ended”

  • That didn’t work either.

I’m a little confused by TouchID

No, don’t use “cursor/mouse over”. You aren’t using the mouse cursor any longer. Multi touch is different to mouse/touch. I’d suggest you also use"the action “De/Activate moving the mouse cursor with touches


If you have multiple touches on the screen, you need to be able to identify each one in order to be able to follow it.

When a new touch is registered, it is given a unique id. This allows you to track the touch while it exists.

In the GDevelop example I linked to previously, when a new touch is registered a marker object is created and that unique TouchID is assigned to the marker object’s variable. That variable is then used to determine which touch the marker belongs to, and to move it to the touch’s position. If the touch has stopped, the marker is removed.

One way for you to get the result you’re after is to create a marker object (like in the example I linked to). Then check whether the marker is colliding with the D-pad or button objects, and execute the actions for that event.

1 Like

Okay that makes sense. If I want the player to use only 1 thumb for the jump, and 1 thumb for the direction. Then I’ll create 2 objects (probably appropriately sized circles) to follow the players thumbs and when it collides with a direction on the pad it will trigger those actions.

Then when the player lets go it will destroy that object.

And just set the opacity to 0 if I don’t want the circle objects on screen

Yep, you pretty much got it. But hide the objects, rather than make them fully opaque. Hidden objects still interact with visible objects, they just aren’t displayed on screen. And it’s faster to render for the game engine.