Jump to content

Phaser 3 scene see my previous scene in my active scene ???


espace
 Share

Recommended Posts

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

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...