Get the number of layers in the current layout

0 favourites
  • 4 posts
From the Asset Store
Create large maps with dynamic depth and precise sprite layering control in top-down games.
  • Hellooo,

    is there a way to count how many layers are existing in the current layout?

    Or maybe loop over all layers to determine a specific layer property, e.g. is visible, for each layer?

    Point is, I have a Settings dialog on it's own layer. When it's displayed I want to prevent all interactivity with layers except the settings dialog.

    I have a number of layers and because it's WIP, the number of layers may change. So I need a dynamic solution.

    Any ideas?

    kind regards

    Sebastian

  • Disable your main inputs event group when settings layer is active, and enable a separate inputs group that only pick/interacts with objects on the settings layer. Don't have to worry about other layers at all.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'll take that

    Thank you very much!

  • Actually, the idea behind the new layer interactivity feature was to make programming easier, avoid creating and managing lots of event groups.

    faaak2 You don't really need to know the total number of layers. You can run a loop Repeat 100 times, and disable interactivity for all layers - Set layer loopindex interactive=false.

    Then enable interactivity only for the layer with the dialog.

    Or make a simple function:

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