0 Favourites

Inherited Layer cross multiple layouts?

  • Folks,

    Do you know if we have this feature in C2? mainly used for HUD and HUD events so we don't have to tweak the HUD on each level.

    I searched forum and found its available in Construct Classic

    scirra.com/forum/hidden-feature-9-inherited-layers_topic37103.html

  • I have a work around for this that I am pretty proud of. Steps are as follows.

    Make sure all your layouts have the same number of layers. Good practice anyway. Including a blank HUD layer.

    Create a specific HUD layout, with the same number of layers.

    Put the HUD elements on the HUD layer in the HUD layout.

    Make them global.

    I organise my game events in a single event sheet - so this is how i do the next step.

    On load layout, I store the name of the current layout in a global variable.

    Load the HUD layout.

    In the HUD's event sheet (not the main event sheet), you have an On Level Loaded event which then loads the layout whose name you stashed in the global variable.

    So basically, whichever layout you load, it immediately loads the HUD layout, which is all globals. And the HUD layout loads the original level back in. The global HUD is preserved. It works perfectly. :)

  • Ahh nice! I will try it out, thanks very much :D

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • foolberry, I'm get stuck, several questions:

    1. how to get the layout name in event? eg I have a global variable called CurrentLevel in my GenericGameplay eventsheet.

    2. in the HUD eventsheet, when layout loaded, do you mean the action called "Go to layout by name"?

    3. Do I need the same layer setup in the HUD layout as well?

    thanks for help!

  • I figured it out:D. if not misunderstanding:

    1.set global variable CurrentLevel = layoutname in level layout. set global variable IsHUDLoaded = 0.

    2. if IsHUDLoaded = 0, goto HUD layout.

    3. in HUD layout, set IsHUDLoaded = 1. then goto layout by name CurrentLevel.

    but there is one problem left: if I quit to Main menu, which is a simple layout when game start. the HUD objects are there too. how do I remove them?

  • Hmm. Never had to do that. Ultimately it's just about deleting or making invisible those HUD objects.

    I'd just do it all in a function - make them all invisible.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)