QuentinIcky Posted November 6, 2016 Share Posted November 6, 2016 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 More sharing options...
Mattia Posted November 7, 2016 Share Posted November 7, 2016 Hi, start() is not a function of "game", but a function of "game.state" (StateManager) , so use this: game.state.start('Boot'); ionprodan 1 Link to comment Share on other sites More sharing options...
QuentinIcky Posted January 24, 2017 Author Share Posted January 24, 2017 Sorry to reply only now, I don't remember how, but I succeeded to do it a few minutes after, so I forgot to come back here. But thanks for your answer ! Link to comment Share on other sites More sharing options...
Recommended Posts