AmbitiousIndie Posted June 1, 2020 Share Posted June 1, 2020 I keep on getting this error while starting my project - 'scene1 is undefined'. what is the problem in the code? I'm quite new PHASER, so a help would be really appreciated :) Also, I've used seperate files for each function. The code is written below, check it out: // the main.js file const config = { type: Phaser.AUTO, width: 800, height: 600, backgroundColor: 0x000000, scene: [scene1, scene2] }; const game = new Phaser.Game(config); // scene1 file class scene1 extends Phaser.Scene{ constructor(){ super({key: 'loading'}); } } preload(){ } // scene2 file class scene2 extends Phaser.Scene{ constructor(){ super({key: 'playing'}); } }; function create(){ this.add.text(20, 20,'loading'); } } Link to comment Share on other sites More sharing options...
Darko Posted June 1, 2020 Share Posted June 1, 2020 Hi, try declaring scene1 and scene2 before your config msanatan 1 Link to comment Share on other sites More sharing options...
Recommended Posts