Layout Instance Variables

0 favourites
  • 10 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi all,

    I don't know if this has been talked about at all, but has there been any discussions around layout variables/properties/metadata?

    At the moment I'm defining per-layout properties with some nasty string manipulation based on the layoutname, then affecting global variables in the logic.

    I'm guessing this would be beyond the scope of a plugin?

  • I dont think its a big issue, each layout needs to be linked with an event. There a workaround you can make an event "compare two values" first layoutname is equal to string of current layout name, then make subevents and do whatever.

  • Yeah that's what I'm doing at the moment, however when you have 50+ levels, and the design process often demands reordering/sorting/renaming, it becomes quite unmanageable.

  • Whats game genre are you making?

  • This is still Mortar Melon - simple physics puzzler.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, the best solution when you include the separated events for one layout, it is up to your codebase design.

  • I got around this by using Group local variables. I will often end up creating a group/event sheet for the level. Then define all the variables on the startup event. That way EVERYTHIGN in that group get's it. Even sub groups.

    Otherwise I tend to use level loaders, but mortar melon looks easier to do per level. good looking game btw :)

  • I found the simplest solution is to just use instance variables on arrays/dictionaries as they don't seem to reset when you change layouts. Lets you name and sort your groups of variables too, a big plus!

    So if you want to access variables that are just for that level, you just compare to the corresponding array. Downside is you can't clone them for some reason, so if you have heaps of variables to add it becomes very tedious.

  • Something I not checked yet - I'm at work - but, could you create a Group in the event sheet for that layout and then have the variables be in that group? They would then be local to the group.

    Of course this would not work if you were using a lot of groups in each event sheet.

  • A few people have mentioned this, but my event sheets are shared between all the layouts. I can't understand why you'd have a per-layout event sheet unless you had logic that you were not going to reuse.

    I think the closest I can get to what I want to achieve is by having a dummy sprite in every level with various instance variables. It's pretty messy but at least then when I duplicate/rename levels it doesn't change.

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