Jump to content

What is the "Stage" in Phaser?


elitian
 Share

Recommended Posts

In this tutorial about game states, there is a part where the author says:

this.game.state.start("GameOver",true,false,score);

"This is the first time I am calling the state with all its arguments, so let’s have a look at them:

GameOver is the name of the state to start.

The second argument is called clearWorld, default at true, and clears the World display list fully (but not the Stage, so if you’ve added your own objects to the Stage they will need managing directly)."

 

What is this "Stage" she talks about? And how would I add my "own" objects to this "Stage", in a way that the clearWorld won't clear these objects and I'll have to manage them directly?

Link to comment
Share on other sites

There are plenty of good tutorials on states in phaser, like http://perplexingtech.weebly.com/game-dev-blog/using-states-in-phaserjs-javascript-game-developement

Think of them as a way of breaking down your game into chunks.. you might have a state for the menu, then a state for the game, and then a state for gameover.

You can pass parameters between these states, and set boolean values of the cache and clearWorld to true or false accordingly. Have a quick google, there's loads of literature on this.

Nick

Link to comment
Share on other sites

The Stage is the base container of display objects. Each application has one Stage object, which contains all on-screen display objects. The Stage is the top-level container and is at the top of the display list hierarchy.

I'm not up to date on Phaser, but in Flash you would just addChild(sprite) or this.addChild(sprite), or even stage.addChild(sprite).

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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