Global Layer Oversight?

0 favourites
  • 8 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hey all,

    Personally I'm thinking this an oversight but I'm curious to see what Ashley and others think. But, I must say having global layers is a complete joy! Thanks for implementing them.

    I'm trying to dynamically turn off/on effects on a Global Layers but I found out there isn't an expression that lets you get a layer's index by passing in it's name. It think this is much more important now that we have Global Layers. With Global Layers we may have the same layer names, but they could be in a completely different order on each layout. Without being able to get the layer's index at runtime it invalidates some of the dynamic nature of Global Layers.

    What I'm proposing is an expression as follows: GetLayerIndex(String layerName).

    Description: "Get the current index of the layer with the name that was passed into the function. If the layer with that name does not exist the expressions returns null( or -1).

    Thanks!

    p.s. I think I could write a plugin that would provide me this but I really feel like this should be an engine feature.

  • Makes sense. Seems simple enough. +1

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, I agree, +1.

  • What do you need it for? You can just type in the layer name right there where the arrow is already pointing to. Every layer parameter in Construct 2 accepts either a number for the index or a string for the name.

  • Is the global layers feature only available in beta at the moment?

  • Ashley

    I was about to ask for the same expression. My use case is I have multiple layers that I need to insert sprites by relative layer order, at runtime. My first inclination was to use "the" expression to convert the top layer name to it's number and then I can reference the lower layers by a relative index. There was no expression though, so I have to keep track of the top layer number and remember to change it as I add layers below the layer range I need to address relatively.

    Seems like it should be a trivial expression to add. Thanks.

  • I'm still not clear why you need to do that - where in C2 do you need a layer index and can't use the layer name?

  • I'm mapping data to layers. I'm doing a step-sequencer where different instruments are on different layers. The data is stored by index, so Voice0, Voice1, etc. I am hoping to support a standard input format with this format. When I load the data in, I load from the top layer, which I know the name of, and wanted to address subsequent layers relative to that one layer.

    Obviously there are many ways to do this, but the most instinctive one was to only need to know the Name of that top layer, ask for it's number (as it may change as I develop the game), and then add the data layer by layer relative to that first layer.

    I'm not saying there are many ways to work around this, but the most obvious one was to just know about that first Name, and then address everything relative to the layers Number. Retrieving the layers number at runtime seems the obvious choice,

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