ninemind Posted March 18, 2014 Share Posted March 18, 2014 Is there any way to overlap scenes? For example, if I have two scenes: SceneGame - background, player, worldSceneGameOver -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? Quote Link to comment Share on other sites More sharing options...
enpu Posted March 18, 2014 Share Posted March 18, 2014 You can only run one scene at a time. You can switch between scenes with:game.system.setScene(SceneTitle);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(); }}); Quote Link to comment Share on other sites More sharing options...
ninemind Posted March 19, 2014 Author Share Posted March 19, 2014 Makes sense, thanks! Quote Link to comment Share on other sites More sharing options...
enpu Posted March 19, 2014 Share Posted March 19, 2014 And you can make layers with game.Containerthis.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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.