Navigation images not working on Android and iPad

The navigation images for up, down, left and right that you need to use with Android and iPad, don’t always work right. I think it is because there is no code for “on release” command.

When playing on Windows, these buttons are hidden because the player uses the mouse and keyboard.

Sometimes when i touch the navigation buttons, an object is sometimes deleted at the same time, this code follows the code above.

Have you considered using multi touch for what you are doing, instead of the mouse emulation with touch (which is effectively what the “Mouse or left button is down” is)? I understand it’ll require a bit of refactoring of your events, but it may work better for you and help with the issues.

This GDevelop multitouch example should help you here.

1 Like

That looks great, now I just have to wrap my head around changing my code, not quite sure how. I am going to do some reading on “A new touch has started”, I never used it before.

(snap shot of your multitouch example, above)

I’d suggest making a small new project, pottering round with it for a few hours to get to grips with multitouch, and then applying what you’ve learnt to your project.

And I just remembered, the multitouch commands may have changed since the example was written. If some of the function names no longer exist, raise it on the forum - there will be someone who can help with the correct function name.

1 Like


Is there a way to prevent multitouches? ie if i touch an arrow image the camera moves, I don’t want to be deleting an object at the same time.

Do you mean to only work with one touch at a time? Keep track of the first touch that is made. Something like this will only keep the player moving with the first touch made on screen if there are no current touches:

Or maybe a slightly safer way:

1 Like

I thought the “Touch or Left mouse button is down” and “The cursor/touch is on (object)” only works with single touch. It works all the time in Windows, but not always on iPad or Android. So the code above will work with all three platforms?

I am going to try your examples out and get back to you. Thanks.

Yes, it will work on all 3 platforms.

1 Like

Well, the arrow buttons move alot slower and it still animates/deletes object that is under the target/cursor when pressing the arrow keys. (on Android/iPad). Before I could hold down the arrows (when they decided to work) and the camera would zoom around, see code above. Now I have to tap, tap, tap all the way thru the game. That happened when I added Trigger Once to the code above.

Does the “A new touch has started” replace “Touch or Left mouse button is down”, Trigger Once above the Cast a ray code? No longer need to specify Left mouse button is down?

I updated the code from above. Now it doesn’t touch the target when I touch the arrow buttons.

No, it just identifies the first time a touch has been made. Each new touch will trigger the “A new touch has started” condition.

Not quite, you need to approach it a little differently. As it stands, you only rotate the camera when a new touch is started. Instead it needs to occur while istouching it true. What you need is something along lines of the following events:

Though this may not be perfect as you could slide the finger across the screen from one button to the other, and activate it

1 Like

Tried this, works in Windows but not on ipad or android. It doesn’t have to work in windows, because the code is for a mobile device. Just thinking out loud!

this too, still not working

I thought maybe I forgot the Trigger Once, but still doesn’t work.

I did read a little of your conversation here
And there is a way that involves using action move mouse cursor with touch on screen and set it to NO

Make every button multitouch joystick button (not analog)
And now you use only mouse or cursor is on that button condition
And works both on desktop and mobile
Sliders work the same way and you can check it by adding a slider while using above action
And you will be able to drag it only on desktop by holding LMB and moving it
On mobile by touch and drag

Or test it here before you do anything
I did not care for clicks on desktop so i left it just as cursor or touch is on object
And so everything work on just hovering over it
Go to settings (icon in upper right corner)
And you will need to click on slider and then you will be able to drag it
Or click on some part of slider to move knob there
It won’t work just on hover
While on mobile it will work with touches

And sorry it is not cursor or touch is on button
But you use button is pressed condition

Tried your suggestions but didn’t work

You don’t need the trigger once because the boolean check effectively does that check.

Just a question - are the buttons in 2D, or are they in a 3D space?

1 Like

2d space on a different “arrows layer”

so I guess I should be using the other cast a ray for 2d. I will paste an image if it works.

You shouldn’t need to use raycast to detect the touch position on an object on a 2D layer.

Like I wrote earlier, make a new, small project just for the multitouch and get that working. Use the preview over network and a browser on the device for it - you can then make changes on the fly and update the preview without having to stop and start it (unless you don’t mind compiling and reloading the apk on every change)

It finally works. Thanks for your help.

1 Like

I needed to test my solution and
Tell me can you click it same way on desktop as you can on mobile

Cause for me on windows i need to hover cursor over it and press LMB
On android i need to touch it
Sliding over it do not work (as expected since we do not want that)

And all i did was use that action to not move cursor with touch

Add to bitmap text object multitouch button (I did set it to W and 11 so it don’t work with any controller)

And now in condition i only need this

Like one single condition
Only Difficulty text have it
But like i said for me it works perfectly as clickable object on both devices
Hovering over it do not work which is the something i did want
Where start game do not have it and on desktop simply hovering cursor over it will start game

So i say it would be pretty much easier solution to implement
And i don’t need to check if my device is mobile or not