eldernos Posted August 19, 2015 Share Posted August 19, 2015 I'm putting together a basic top-down scrolling game and I have three groups of background tiles moving down the screen. I also have a character I add as a sprite but cannot get it to show up on top. I've tried bringToTop(), adding it to another group, enabling physics (like the background ones), adding it last, adding it first. My State object has three groups set at zero z and the sprite at 5 and it still never shows up. If I don't ever create the other groups, I'm fine. Does it matter that my character is a class derived from Phaser.Sprite instead of just a sprite? I can't find any reason this is happening. Thanks Link to comment Share on other sites More sharing options...
icp Posted August 19, 2015 Share Posted August 19, 2015 Make your player sprite the last one added. Link to comment Share on other sites More sharing options...
rich Posted August 19, 2015 Share Posted August 19, 2015 The Display List works in a bottom-up manner. So any Groups or Sprites created first will always appear behind any Groups or Sprites created after them. bringToTop only brings a Sprite to the top of its parent Group - if it has one. For example if you add Group A, B and C (where A is on the bottom, B in the middle and C on the top) and your player is in Group A then calling bringToTop on the player will still make it visually appear behind Groups B and C. jzcodes 1 Link to comment Share on other sites More sharing options...
Recommended Posts