That would work, but it won't save the player's progress. So if the player closed the game and reopened it, he would be back at level 1.
Also, it is not a good idea to have multiple copies of the same event sheet. Even if some of the variables have different values.
- What if you wanted to change how the game works? You'd have to change the same little thing for all of the levels.
- It increases the file size more than nessesary. In a case where you have a lot of events for each level, the player will become impatient when your game takes forever to load and go find a different game to play.
- If you wanted to add a few levels, you'd have to duplicate one of the event sheets and change it accordingly.
It is better not to repeat the same instructions over and over, but instead to say it once and put variable where it's different.
Instead, you should do something like this:
Make one sprite object, name it levelbox. Right-click on it, choose add/edit instance variables, click the green plus sign, name the variable level and give it a type of text, click ok, and close the add/edit instance variables window. Hold ctrl and move the levelbox. This copies it. Do this until you have enough for each level. Edit each one to have the name of one of the levels (layouts) in the level instance variable (you can find it in the properties). If you don't want to type the name out each time, you can copy something like "Level " to the clipboard and paste that into the textbox then type the number. Example: Click levelbox, click the box next to "Instance Variables, level", press Ctrl+V, type "1", click the next levelbox, click the box next to "Instance Variables, level", press Ctrl+V, type "2", etc.
-- Menu Events --
system.every tick -> set opacity to 40 for all level boxes in the menu.
Declare Local Variable unlock_level = 1
System - For Each levelbox
If unlock_level = 1 -> then set levelbox opacity to 100%
(Event with no conditions) -> System > set variable unlock_level to WebStore.getLocalKey(levelbox.level)
On levelbox clicked, and -
levelbox opacity is 100% -> system go to levelbox.level
-- Game Events --
When a level is finished -> WebStorage > Set Local Key > LayoutName to 1.