Search the Community
Showing results for tags 'Phaser States'.
-
Hi guys! So this is probably an easy question to answer, but everything I tried so far broke my code. So I am using states MMM.MainGame = function(game){ } MMM.MainGame.prototype = { create: function() { .... }; The issue that I am having is that I will not have that many states, besides booting, preloading, and the actual game, so my main game file is already getting pretty big with 100 lines alone for zooming in and out. Is there a way to export these functions somehow to external js files and put them together in the MainGame.prototype? Something like extends? I need some good practice advice here, because my main file will otherwise easily become thousands of lines and just one messy hell.
- 2 replies
-
- Phaser States
- File Structure
-
(and 1 more)
Tagged with:
-
Hello everyone, I'm trying to test some state features in Phaser, but I got some problem here. I need to bind a call to a function for loading next state when user click on a button, i.e: BasicGame.MainMenu.prototype = { create: function () {[...] this.gameTitle.events.onInputDown.add( this.startgame, this); }, startgame: function () { alert("ok"); this.state.start('reception'); }, [...]}All seems ok but when I try to load page, nothing happens inside the "startgame" block (I expected to see "ok" alert, btw). What am I doing wrong, or what is the right way of doing this? Thanks in advance!