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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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