Jump to content

State example


Recommended Posts



So I have one level in a js file and another level in another js file;


The great guys in the chat room say I need to use states to manage switching between levels, but I havent seen any examples or tutorials on this. Would I just let my first level load then when player overlaps tile X run some function that uses the state function to load level2.js.




Link to comment
Share on other sites

Sorry for double post I didn't want to open a new thread, I'm having trouble loading a new state when you click an image (play button);

I have this currently;

this.add.sprite(170, 170, 'playBtn', this.startGame);

Then my game.js file starts

BasicGame.Game = function (game) {

My game state is:

game.state.add('Game', BasicGame.Game);


Link to comment
Share on other sites

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.

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.


  • Recently Browsing   0 members

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