valueerror Posted May 12, 2014 Share Posted May 12, 2014 layerforeground.bringToTop();this is the line at the end of my create function to make sure my player walks behind this layer..good.. but i want all my enemies to be in front of the foregroundlayer.. if i bring my enemies to top in a foreach loop they will only be on top of their own group... as the documentation states.. so i tried this:enemies.z = layerforeground.z + 1;and the group "enemies" gets the z-index 33 while layerforeground has 32.. i thought that the group would now be infront of the layer but it isnt Link to comment Share on other sites More sharing options...
ianmcgregor Posted May 12, 2014 Share Posted May 12, 2014 If your foreground has the same parent group (the default world group?) as your enemies group then you should be able to move the whole layer to the top:enemies.parent.bringToTop(enemies); Link to comment Share on other sites More sharing options...
valueerror Posted May 12, 2014 Author Share Posted May 12, 2014 TypeError: Cannot read property 'parent' of undefined the group is there.. parent is the world.. at least a console.log(enemies.parent) says that at the same place.. thats weird... Link to comment Share on other sites More sharing options...
ianmcgregor Posted May 12, 2014 Share Posted May 12, 2014 That is weird! Post more code if you feel like it and I'll have a look. Link to comment Share on other sites More sharing options...
jagged0815 Posted October 10, 2015 Share Posted October 10, 2015 try this: game.world.bringToTop( <your Groupe or Graphic> ); adamsko 1 Link to comment Share on other sites More sharing options...
adamsko Posted March 9, 2016 Share Posted March 9, 2016 On 10/10/2015 at 10:21 PM, jagged0815 said: try this: game.world.bringToTop( <your Groupe or Graphic> ); Works. Group has a world as its parent, so this is the way, to bring the group to the top. Link to comment Share on other sites More sharing options...
Recommended Posts