Hi everyone,
I tried to restart a scene with a new data. I found that the timer event on that scene reset correctly but the images from the old scene still display instead of new image I want to render. Is this a bug? Here my code:
// I have 2 scene: Menu and Play.
// The Menu scene have a Play button, when clicked, game moved to Play scene
this.PLAY_BUTTON.on("pointerdown", function(pointer){
if(this.FIRST_TIME) {
this.scene.start(CST.SCENES.PLAY, this.SELECTED_TYPE);
this.scene.setVisible(true, CST.SCENES.PLAY);
console.log('first load');
} else {
if (this.SELECTED_TYPE != this.CURRENT_TYPE) {
this.scene.stop(); // stop the menu scene
var getPlayScene = this.scene.get(CST.SCENES.PLAY); // get the play scene
getPlayScene.scene.restart(this.SELECTED_TYPE); // reset the play scene
this.scene.setVisible(true, CST.SCENES.PLAY);
console.log('update');
} else {
this.scene.stop();
this.scene.resume(CST.SCENES.PLAY);
this.scene.setVisible(true, CST.SCENES.PLAY);
console.log(
'resume'
);
}
}
}, this);
}