ManBoy Posted March 15, 2014 Share Posted March 15, 2014 var layerFg = game.add.group();layerFg.z = 1;layerFg.create(0,0,'Atlas','Player.png');var layerBg = game.add.group();layerBg.create(0,0,'Atlas','Background.jpg');layerBg.z = 0;var layerFg = game.add.group();layerFg.z = 1;var fg = new Phaser.Sprite(game,0,0,'Atlas','Player.png');layerFg.add(fg);layerBg = game.add.group();layerBg.z = 0;var bg = new Phaser.Sprite(game,0,0,'Atlas','Background.jpg');layerBg.add(bg);I tried both codes, none are working. Btw I am still using 1.16 microspace 1 Link to comment Share on other sites More sharing options...
qdrj Posted March 15, 2014 Share Posted March 15, 2014 Create bg group first. No need to use z property in such case. Or use your code but add something like this after all (maybe you will need to replace world for actual parent group)world.sort("z"); Link to comment Share on other sites More sharing options...
ManBoy Posted March 15, 2014 Author Share Posted March 15, 2014 I deliberately create them in that order because I want to test if it's workinggame.world.sort('z');It's still not working though Link to comment Share on other sites More sharing options...
rich Posted March 16, 2014 Share Posted March 16, 2014 Groups can't be sorted like this in 1.1.6 (not without writing your own sort function), sorry. In 2.0 they have a native z index (as do Sprites now) which you can sort on. Link to comment Share on other sites More sharing options...
Recommended Posts