Jump to content

Overlapping Scenes


Recommended Posts

Is there any way to overlap scenes?  For example, if I have two scenes:


SceneGame - background, player, world

SceneGameOver -scoreboard


and want to see SceneGameOver on top of SceneGame so that the scoreboard shows over the top of the game.


Looking at the examples PandaJS provides on their website, everything is kept in SceneGame.  This, in my opinion, creates too much clutter.  It would be much nicer to have separate scenes that can either replace each other on screen, or overlap.


Does a solution for this already exist?

Link to comment
Share on other sites

You can only run one scene at a time. You can switch between scenes with:


I would suggest you to wrap scoreboard into class, then your scene class can be nice and clean, like:

Scoreboard = game.Class.extend({    init: function() {        // Init your scoreboard    }});SceneGame = game.Scene.extend({    init: function() {        this.scoreboard = new Scoreboard();    }});
Link to comment
Share on other sites

And you can make layers with game.Container

this.mainLayer = new game.Container();this.stage.addChild(this.mainLayer);this.scoreLayer = new game.Container();this.stage.addChild(this.scoreLayer);var sprite = new game.Sprite('mySprite');this.scoreLayer.addChild(sprite);
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...