Jump to content

State example


xronn
 Share

Recommended Posts

Hi,

 

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

level1.js
level2.js

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.

 

 

Thanks!

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

 Share

  • Recently Browsing   0 members

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