Windows Advance Level Unlocking

scorpafied

Member
GM Version: Gamemaker Studio 2
Target Platform: all
Download: Click Here
Links: N/A
Summary:
Unlock level system which allows you to unlock as many levels in any order you wish.

Tutorial:
Unlike the basic system which i posted here which only worked if you unlock levels one after the other. This one actually tracks whats happening in an individual level. Meaning it offers a lot more control and allows you to use it how you please.

And here's a snippet of code from the engine:

Code:
if(ds_map_find_value(global.lvlData[levels],"unlocked")==1){
    image_index = 1; // show unlocked
} 
else if(ds_map_find_value(global.lvlData[levels],"unlocked")==0) image_index = 0; // other wise its lower and still locked

if(ds_map_find_value(global.lvlData[levels],"beat")==1) { // if we have unlocked more then we must of beat it
    image_index = 2;
}

So the run down here is it uses an array. Each index of the array holds a ds_map which stores data on our level. If you haven't ever used a ds map it's pretty easy don't worry. It's kind of like an having a bunch of arrays which you can refer to with a keyword. In our case each one of ours will look like this:

Code:
{
"unlocked": [1]
"beat": [0]
}
The numbers inside of the brackets is the data on our level. And the keyword is how we look at it. And each index of our array has one of these which represents each one of our levels.

The controls when you're testing are:
- left click checks if it's unlocked or not
- right click unlocks a level if it's locked or if it's already unlocked then it beats it

What I love most about this, is it's really easy to expand to track other stuff like how many times you die in a level or how fast you beat it in etc.... so what do you all think?
 
Last edited by a moderator:
Top