Game pause problems with character movement

mataruamatarua Auckland, New ZealandMember Posts: 854
I have created a pause scene in my game which works great, but...

But my character is controlled by touching the screen so that means when the game is paused the character also receives a touch event. And when the game is unpaused the same thing happens.

So to try and solve this with logic I created a boolean attribute game.isGamePaused to turn off the character controls when the game is paused. I even put a timer in there to be safe. But when the timer finishes I still get a hit on the screen which I thought could be from the first touch.

To test that I replaced the touch event to end pause, with a the keypress P. And I am still getting the hit on the screen - but my logic game.isGamePaused is working to disable further touches or perhaps the game is just paused.

So, I have figured out that when the pause button is pressed the player also gets a touch event. That touch event waits until the game is unpaused and then fires.

Do I have to put a button over my screen but not near the pause button to make this work properly?

Comments

  • mataruamatarua Auckland, New ZealandMember Posts: 854
    I can solve this by putting a big button over most of the screen that's alpha zero but this will impact performance on lower spec devices. Too many layers of actors does that. So a tech fix would be good if possible.

    I have tried resetting touch and mouse counts to zero but that has no effect.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Do you have a pause/unpause button overlaying the character actor? Are you using When mouse is down? Even so, it shouldn't cause a problem.

    I just created a quick test and I didn't have the problem you're describing. In the test, click on the lower left white square to pause the game. Click on the upper right square to unpause. If you have the log debugger window open, you should see "mouse down" when you click to pause but not when you click to unpause.
Sign In or Register to comment.