Jump to content

"start is not a function"


QuentinIcky
 Share

Recommended Posts

Hi all ! 

 

I'm new to Phaser. I follow this tutorial (https://www.youtube.com/watch?v=2JWbytEGjhM&list=PL9iYZZWgVwsfNdldSzmYev0tbVKjeov6w) to build a game, but I have this error : 

"Uncaught TypeError: game.start is not a function at window.onload". 

Here is my main function : 

window.onload = function() {
        var game = new Phaser.Game(800, 600, Phaser, '');
        // var game = new Phaser.Game(800, 600, Phaser, CANVAS, '');

        game.state.add('Boot', Game.Boot);
        game.state.add('Preloader', Game.Preloader);
        game.state.add('MainMenu', Game.MainMenu);
        game.state.add('Level1', Game.Level1);

        game.start('Boot');
    }

and the Boot file :

var Game = {};

Game.Boot = function(game) {

};

Game.Boot.prototype = {
	init:function() {
		this.input.maxPointers = 1;
		this.stage.disableVisibilityChange = true;
	},
	preload : function() {
		this.load.image('preloadBar', '../assets/coin.png');
	},

	create: function() {
		this.state.start('Preloader');
	}
}

 

I didn't find any answer on the web. If you have an idea it could be helpful.
Thanks by advance !  

Link to comment
Share on other sites

  • 2 months later...
 Share

  • Recently Browsing   0 members

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