Sign in to follow this  
QuentinIcky

"start is not a function"

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 !  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.