Event/Action and Layers With Similar Strings

Imagine you have a few layers called background, groundDirt, groundStone, groundBrick, charSprite, hud.

Is there a way to do a “show all layers with ‘ground’ in the name”?
It’s either this or I’ll have to go through tons of actions or comparing with tons of events.

Thank you in advanced!

You can group them likeso:

if ShowLetters variable = 1 
             Show layer a
             Show layer b
             Show layer c
1 Like

Could you please explain this a little more? I need the fundamental understanding before I need the solution, that way I don’t forget it.

Is ShowLetters a custom variable? I’m afraid I can’t make heads or tails of this solution.

Thank you!

Hi

ShowLetters was a variable indeed. If you’re not familiar with variables, check this page :slight_smile:

When you want to show all the ground layers, turn the variable to 1 and the snippet above will show them.
Then you need to make the same with variable = 0 to hide the layers if necessary.

We’re grouping layers under a single variable to avoid multiplying the events, then we’ll turn this variable to 0 or 1 depending on whether we want to see the group of layers or not.