valueerror Posted June 15, 2014 Share Posted June 15, 2014 i want my player controls to be always on top of everything.. even on top of those things i eventuallu bringToTop(); what is the best way to accomplish this? thx in advance! Link to comment Share on other sites More sharing options...
lewster32 Posted June 15, 2014 Share Posted June 15, 2014 Use groups. Create two groups, one for everything in your game except the controls, and another after that for your controls. Everything you add to the first group will be displayed beneath the second group, even when brought to the top. Link to comment Share on other sites More sharing options...
valueerror Posted June 16, 2014 Author Share Posted June 16, 2014 huh.. thx.. so i have to add everything in my game to the first group.. that's a lot ! layers, backgrounds, powerups, enemies, bullets.. Link to comment Share on other sites More sharing options...
lewster32 Posted June 16, 2014 Share Posted June 16, 2014 Yeah, it shouldn't change anything fundamentally, it just ensures ordering is correct. In a scene graph (which Phaser uses) this is the logical way it's done. Link to comment Share on other sites More sharing options...
valueerror Posted June 16, 2014 Author Share Posted June 16, 2014 ok. thank you.. i did what you suggested and it wasn't that much work after all.. in fact i created 4 different groups and now i am able to set their z-index in a reliable way .. so this is very good now.. Link to comment Share on other sites More sharing options...
lewster32 Posted June 16, 2014 Share Posted June 16, 2014 Great stuff Usually in my games I have at least a background group, a midground group (containing the game sprites), a foreground group (for explosions and other effects) and finally on top a UI group for score, text etc. KevinnFtw 1 Link to comment Share on other sites More sharing options...
Recommended Posts