A layout for each level?

0 favourites
  • 10 posts
From the Asset Store
LevelsManager is a Construct 2 & 3 plugin to manage your worlds and levels easily
  • Hi, I want some advice on how best to use layouts. I currently have 3:

    Menu

    Level 1

    Level 2

    Obviously my menu is very different to the others. It has a start button and is what the player will see first. And also what they will see when they die.

    Level 1 has my character, the game level, and also lots of global elements that make up the HUD. I've made these elements global, so that I don't have to duplicate them on every other level. Because if I eventually have 20 levels, and want to change the layout of the HUD, I'll have to change each one!

    So Level 2 is very basic, it just has the character and the level. No global elements. But when you play the game, you'll see these global elements as it'll pick them up from Level 1.

    When the player goes back to the menu though, all of the global elements still show, overlapping the menu!

    I wondered if anyone else has had this exact same problem? And how have you solved it?

  • The simplest way I can think to address this "problem" (technically it's a feature more than anything) is to hide the UI elements when you don't need them.

    Since you're still using the free version of C2 you won't have access to families, but you can create an event in your menu event sheet that, on the start of the layout, sets each UI element to invisible (families would let you do this as a single action). Then just make sure that you do the opposite in each actual level's event sheet.

    If these are UI elements that are interactive, then add a condition to their interaction events that checks if they're visible before performing the action.

  • <img src="http://i.imgur.com/Ol7OMtl.jpg1" border="0" />

    Haha yeah you're right, it's not a problem, as it's doing what's intended! Although it does provide something for me to work around.

    I suppose it's not a massive deal for me to include the elements on every layout, I'm just worried about the problems that happen when you multiply things up. I might have 100 layouts, and then want to start changing things, and have to then change the same thing on 100 layouts!

    What might be best to do is to add the interface elements by an event. Is that a fairly normal thing to do?

  • Making, for example, the UI as a global sprite object on your menu, or loading screen, and then set it invisible, and only visible when on purpose may work.

    Did you tried it?

  • The way I'd do it is forget the global objects and instead spawn the UI objects with events on start of layout. I just can't stand having invisible UI objects in my menu :D

  • onion, you definitely don't want to add your UI elements per layout. That is going to be an issue as your project grows.

    Your options are to use global objects and just hide/show them as necessary, or, yes, use events to build them as necessary. I chose the the latter and it works well enough for me.

  • I did an eventsheet exclusively for UI and then I INCLUDE it to the STAGE eventsheet and works flawless too.

  • Okay thanks guys, it sounds like a good idea would be to load interface elements from the event sheet. Then it'll give me more flexibility for changing when the project gets bigger.

    So let me just check though, the best way to do this is on start of layout, system > create new object > sprite1etc at (x,y)

    And also have an unused instance of this sprite positioned off the layout somewhere, just so it will be included in the project?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would just use a separate layer for the UI elements. Then when you don't need them you just hide that layer. Helps me when working in the editor as well, I can lock that layer and make it invisible in the editor and not worry about it when adding in tiles.

    Then I just have a template layout that I start each level layout from that has the UI layer built in.

    If later on in a different level you decide you need to tweak the UI, then just modify the UI layer for that particular level.

  • Problem is though spartyon, what if I have a hundred levels and want to change how the interface elements look. I'd have to change it on 100 layouts! I much prefer sqiddster's idea of spawning it from an event sheet, then I only have 1 place to change.

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