mrSully Posted September 24, 2014 Share Posted September 24, 2014 "Phaser.StateManager - No state found with the key: ScrollPuzzle" HEIGHT and WIDTH are declared in another file, which is included beforehand original code: var states = {}; var temp = 0; states.ScrollingPuzzle = function(game){ }; states.ScrollingPuzzle.prototype = {//var ScrollState = { preload : function() { currentLevel = 1; this.load.image('ball', 'imgs/ball.png'); //this.load.image('stick', 'imgs/stick.png'); this.load.image('table', 'imgs/table.png'); //this.load.image('sides', 'imgs/sides.png'); }, create : function() { this.table = this.add.sprite(0, -(tableHeights[currentLevel - 1] - HEIGHT), 'table'); this.ball = this.add.sprite(WIDTH/2 - ballSize/2, HEIGHT - 100, 'ball'); }, update : function() { temp++; }} var game = new Phaser.Game(WIDTH, HEIGHT, Phaser.AUTO, 'game'); game.state.add('ScrollPuzzle', game.ScrollingPuzzle); game.state.start('ScrollPuzzle'); What exactly did I do wrong and how can I correct this? I am also curious as to why I always seem to see "'navigator.webkitGetGamepads' is deprecated. Please use 'navigator.getGamepads' instead. " and if there is something to do about it. Thanks in advance! Link to comment Share on other sites More sharing options...
JUL Posted September 24, 2014 Share Posted September 24, 2014 var game = new Phaser.Game(STAGE_WIDTH, STAGE_HEIGHT, Phaser.CANVAS,'',null,false,false); Game = {};Game.Level0 = function (game) { };Game.Level0.prototype = { create: function () {}, update: function () {}, render: function () {}, shutdown: function () {}}; Game.Level1 = function (game) { };Game.Level1.prototype = { create: function () {}, update: function () {}, render: function () {}, shutdown: function () {}};game.state.add('Level0', Game.Level0);game.state.add('Level1', Game.Level1);game.state.start('Level0'); Link to comment Share on other sites More sharing options...
Recommended Posts