Home Game Development Problem With Pausing The Game – Cocos Creator

Problem With Pausing The Game – Cocos Creator

0
Problem With Pausing The Game – Cocos Creator

[ad_1]

Hi Everyone ! …
So in my recreation when the battle is occurring and that i press on the “pause” button the pase
menu opens and the sport pauses till i click on on resume … however i’m going through an issue
when i exploit both browser or simulator and reduce the window or go to a different tab and return to the sport the sport routinely resumes though the pause menu continues to be open … i hope somebody may help me with this ! Thanks
that is the code for pausing :
waitBtn() { // pause button

    let all = cc.discover("Canvas");

    let button = cc.discover("Canvas/AllBtn/WaitBtn")

    //Resume all contact click on occasions

    //Delayed execution pause

    this.scheduleOnce(operate() {

        all.pauseSystemEvents(true); //Pause all contact click on occasions

        this.Menu.energetic = true

        this.Menu.resumeSystemEvents(true);

        // Increased  zIndex Property To Menu

        this.Menu.zIndex = 100

        cc.recreation.pause();

    }, 0.15);

    button.interactable = false

},

cc.recreation.on(cc.recreation.EVENT_SHOW, operate () {
      // do one thing
});

this occasion triggered when recreation again to foreground,you may re-pause within the callback

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here