
killer_manatee
Members-
Content Count
6 -
Joined
-
Last visited
About killer_manatee
-
Rank
Newbie
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
-
Trying to load stages: Invalid Phaser State object given
killer_manatee replied to killer_manatee's topic in Phaser 2
You were totally right about the first solution. The problem was that I forgot to change var bootState = require('./boot'); to import bootState from './boot'; Thanks! -
killer_manatee reacted to a post in a topic: Trying to load stages: Invalid Phaser State object given
-
Trying to load stages: Invalid Phaser State object given
killer_manatee replied to killer_manatee's topic in Phaser 2
Hi, I tried that but I'm still getting the same exact error -
Hello. I'm trying to refactor my code into multiple files and create various stages. Here's how I do it: // game.js var bootState = require('./boot'); var loadState = require('./load'); var mygame = new Phaser.Game(800, 600, Phaser.AUTO); mygame.state.add('boot', bootState); mygame.state.start('boot'); export {mygame}; //boot.js import { mygame } from './game.js'; var bootState = { create() { mygame.physics.startSystem(Phaser.Physics.ARCADE); } }; export {bootState}; I've also tried changing boot.js to import { mygame } from './game.js'; var bootState = { create: function() { mygame.physics.startSystem(Phaser.Physics.ARCADE); mygame.state.start('load'); } }; export {bootState}; but that doesn't work either. I'm getting 'Invalid Phaser State object given. Must contain at least a one of the required functions: preload, create, update or render'. Thanks
-
Thanks, I will try this and get back!
-
Hi all, Brand new to phaser. When I do: katamari = game.add.sprite(32, game.world.height - 150, 'katamari'); it works great, but when I refactor to make my code prettier/more object oriented: function Unit(game, x, y, spriteName) { Phaser.Sprite.call(this, game, x, y, 'units', spriteName); // base unit stuff goes here } Unit.prototype = Object.create(Phaser.Sprite.prototype); Unit.prototype.constructor = Unit; ... katamari = new Unit(game, 32, game.world.height - 150, 'katamari'); game.add.existing(katamari); The sprite image fails to load. I am preloading the image correctly because it works in the first case. I have no idea why this is happening. Thanks Edit: Realized issue in constructor, would delete if forum allowed
-
Hi all, Brand new to Phaser. I'm making a katamari fan game, and so far i have the character and the ball, but I want the prince character to be on the left side of the ball when moving right and on the right side while moving left. Is there a way to tell a sprite group to be a mirror image of itself only when moving to the right? Thanks