[SOLVED] Different scenes taking same touch input

I have a ‘stop’ button. When this button is touched, the scene changes to the scene ‘Homepage’. In the Homepage scene, someone can start a new game by touching anything on the screen. I have this problem changing to the scene Homepage:
When I touch the ‘stop’ button, the game changes to the scene Homepage, but the game starts directly because of touching the stop button. So with one touch on the ‘Stop’ button you can change to the scene Homepage and start the game. This is not what I want. I want to change to the scene ‘Homepage’ by using the ‘Stop’ button, and after the player must touch again to start the game. Using trigger once is not working. Any solution?

How are the pause and start events constructed? Are you including the condition that when you are on the homepage you must start a touch to start? I assume that it is for touch device what you are trying to solve. It is possible that when you go to that scene it still takes the touches that the player was already pressing to press the “stop” button and therefore sends you to the beginning of the game again. Have you tried the condition that “a new touch has been started”? I don’t know if in touch devices it detects only if there is a new touch or it also takes what is being pressed. Another alternative is that starting that scene starts a “start” timer. Then, in addition to the condition of having a touch to start the game, another condition that the timer must be greater than…0.5 seconds (for example) to start. The start/reset counter event must be above the game start event.

1 Like

This is a common issue when using the Mouse is over [object] and Mouse button is pressed or touch is held.

If this is what you are doing, then the following should help :

Chances are you have the Stop button on the pause scene at the same spot as the Play button on the Home scene. And when the mouse is over the Stop button, and the LMB is pressed/touch held, it starts the Homepage scene. And as the mouse is now over the Play button, and the mous button is still down or touch is still held, play will start.

An easy fix is to just change the Mouse button is pressed or touch held to Mouse button released.

2 Likes

I used an extra condition called touch has ended, this solved the problem
Thanks

You’re mixing mouse/single touch controls with multi touch controls. It’s not usually recommended, but in this case it seems to do the trick. But be aware there is potential for a bug here.

2 Likes

4 Likes

In this case, if the OP apply one timer “cooldown” (2 - 3 sec) when you touch the button “Stop” to detect again the touch screen, that can help and avoid fake touches no?

1 Like

Maybe a global timer, but it could disrupt the player’s enjoyment. You’d lose the ability to quickly tap and tap again to restart the game.

I prefer @arthuro555’s solution - it’s tidy one that works well.

2 Likes

I was struggling with the same problem.
Whenever user touch the object in different scene it get also applied to next scene if object in same position in my android game.
This (image attach) is what I have found the solution, its not the perfect solution but works in most (at least mine) cases
example

1 Like

I found this multi touch event in gdevelop wiki page.
This solved every touch related issues.

Wiki link:-
https://wiki.gdevelop.io/gdevelop5/all-features/mouse-touch

Multi touch example:-

My game event
I replaced “marker” with a sprite named “touch position”

This is how it looks in game