Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Phaser states vs custom states


jjcale
 Share

Recommended Posts

Hi all,

I am new to Phaser and I would like to understand the difference between Phaser states and custom states. In essence, I understand the following concept very well:

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });

function preload() {
}

function create() {
}

function update() {
    // runs 60 time per second
}

Now, I have seen a lot of examples with custom states (gateways/stages in my game), and again I understand the concept well. Now how do these two concepts work together? How do I use the Phaser 60/s function in my custom states? Yes, this may be a newbie question, but I find Phaser documentation rather complicated.

Thank you!

JJ

 

Link to comment
Share on other sites

1 hour ago, jjcale said:

I am new to Phaser and I would like to understand the difference between Phaser states and custom states.

They're all the same kind. :) A state is a set of callbacks comprising an init–preload–create–update/render–shutdown cycle. In simple games (like all the Phaser examples), you're just filling in the methods of the default state.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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