espace Posted April 7, 2019 Share Posted April 7, 2019 hi, curiosly when i use scene with phaser 3 like phaser 2 i see my previous scene behind my active scene... How do you do to have the same behaviour than phaser 2 : not see the previous scene in the active scene ? console.clear(); var config = { type: Phaser.AUTO, width: 1480, height: 2270, backgroundColor: '#0d1018', physics: { default: "arcade", arcade: { gravity: { y: 200 } } }, callbacks: { postBoot: function (game) { // In v3.15, you have to override Phaser's default styles game.canvas.style.width = '100%'; game.canvas.style.height = '100%'; } }, }; var state = {}; var o = {}; state.boot = { preload: function () { this.load.image("Enemy", "img/ball_enemy.png"); }, create: function () { o.enemy = this.add.sprite(740, 1135, 'Enemy'); game.scene.start('main'); }, }; state.main = { preload: function () { this.load.image("Player", "img/ball_enemy.png"); }, create: function () { //here i see o.enemy in my state.main ??? o.player = this.add.sprite(140, 835, 'Player'); }, }; var game = new Phaser.Game(config); game.scene.add('boot', state.boot, true); game.scene.add('main', state.main, true); game.scene.start('boot'); Link to comment Share on other sites More sharing options...
theNeedle Posted April 16, 2019 Share Posted April 16, 2019 Scene in Phaser 3 is not same as State in Phaser 2. If you don't stop one scene and start another, both scenes will be visible. So, you need to stop the previous scene (boot) before starting new scene(main). Link to comment Share on other sites More sharing options...
Recommended Posts