MackTuesday Posted December 6, 2017 Share Posted December 6, 2017 The game I'm working on has the screen divided into a few frames. The contents of the frames can change depending on game state, but the layout -- borders, border art, frame sizes and positions -- always stays the same. If I have a global layout building function that all states share, is that an acceptable design? Is there a better way? Link to comment Share on other sites More sharing options...
samme Posted December 7, 2017 Share Posted December 7, 2017 You can add them all to the Stage (game.stage) instead. Link to comment Share on other sites More sharing options...
MackTuesday Posted December 12, 2017 Author Share Posted December 12, 2017 Thanks. So for example I would add a sprite to the stage instead of the world with var whatever = game.add.sprite(x, y, 'whateverKey', null, game.stage); right? Or should the frame be 0 instead of null? The code seems to indicate either will work, but I might have misinterpreted what I saw in the listings. Link to comment Share on other sites More sharing options...
samme Posted December 12, 2017 Share Posted December 12, 2017 You can't yet pass the stage as the parent argument (that's in the works), so: var whatever = game.make.sprite(x, y, 'whateverKey'); game.stage.addChild(whatever); Link to comment Share on other sites More sharing options...
MackTuesday Posted December 12, 2017 Author Share Posted December 12, 2017 Awesome. Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts