jshou Posted June 22, 2014 Share Posted June 22, 2014 I'm loading a player sprite on scene, and then a lot of obstacle sprites afterwards. How do I keep the player sprite from rendering underneath all the other ones? Quote Link to comment Share on other sites More sharing options...
fuzzee Posted June 22, 2014 Share Posted June 22, 2014 Use game.Container()e.g.SceneGame = game.Scene.extend({ init: function () { this.obstacleContainer = new game.Container(); this.playerContaier = new game.Contaier(); // this order is important when adding to stage this.stage.addChild(obstacleContainer); this.stage.addChild(playerContaier); this.player = new game.Sprite('media/player.png', game.system.width / 2, game.system.height / 2, { anchor: { x: 0.5, y: 0.5 } }); this.playerContaier.addChild(this.player); // later in code // appears under the player this.obstacleContainer.addChild(...); });}); 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.