Well, I'd suggest either an array that holds if the level is unlocked, or a variable that holds how many levels you have unlocked (in this case called levels_beat). Since the second one requires no knowledge of arrays I'll explain that one. You'll use a clone of buttons that load the level. The clone.0 will load the first level, clone.1 the second and so on. I'm going to assume you have a load level function, but if you don't all it does is load up a certain level. Also just to make sure there is a variable cur_level that holds what the current level is. Here's what the mouse button down might look like.
level_select -> Mouse Button Down Left -> Script Editor
- Code: Select all
if(levels_beat>=cloneindex)
{
cur_level=cloneindex;
load_level(cloneindex);
}
Now if you want them to be grayed out when you haven't unlocked them you can use draw actor, or activation events, and use this.
level_select -> Draw Actor -> Script Editor
- Code: Select all
int unlocked = (levels_beat>=cloneindex)+127;
r=unlocked+128;
g=unlocked+128;
b=unlocked+128;
Now when you beat a new level (also determined by this script) you increase it by 1.
- Code: Select all
levels_beat+=levels_beat==cur_level;