elitian

What is the "Stage" in Phaser?

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?

Share this post


Link to post
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

Share this post


Link to post
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).

Share this post


Link to post
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.

Guest
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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.