I am working on a game. and I have built several layouts (play area(numerous layouts), map, hud, inventory, battle) what i want to achieve is having the play area as my main layout with the hud layout supper imposed over it, I know that i could use layers to add the the hud to each play area layout, but think there mist be an easier way.
I also want to be able to call other layout eg inventory, without losing the progress of the main layout. eg play opens inventory to check what he is holding, and then closing the inventory and is still in the same position as they were before they opened the inventory.
hope this makes seance.
Think you can make all the objects on the layouts global, that will not destroy them on "end of layout". However havent tried it a lot. So not sure if it can do what you need.
layouts are completely separate you can't show one on top of the other, that is what global objects and layers are for.
so in theory if a put my hud on a layer called hud in a layout and made all the sprites global and made a hud event sheet that made all the sprites visible then on all my other layouts made a blank layer called hud, and in the event sheets for those layouts put an include event sheet command to the hud event sheet, then the hud should work in all layouts
Develop games in your browser. Powerful, performant & highly capable.
Actually, that's a pretty smart idea.
I played around with it and it indeed works. Only issue is that it comes in at the bottom of the z-order on the bottom-most layer, but that's an easy fix.
I'd suggest adding all of your UI elements to a family (or two families, if you have a mix of sprites and text objects) and then, at the start of each new layout either send the entire family to the top-most layer in your layout (in the case of actual in-game layouts) or to an invisible layer at the bottom (in the case of menu or option screens). Regardless of the layout you're on, you'll always have to find something to do with your UI elements.
I have been playing around with this and it works just as i want, and all I had to do for the z layer problem was add a move to to command. happy days. oh and the hud layout had to be the first in order, so that the graphics loaded into the system