1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Windows Basic Level Unlocking System

Discussion in 'Tutorials' started by scorpafied, Jan 19, 2020.

  1. scorpafied

    scorpafied Member

    Joined:
    Feb 8, 2019
    Posts:
    22
    Hello and welcome, to my Level Unlocking System

    GM Version: Gamemaker Studio 2
    Target Platform: All
    Download: Click Here
    Links: N/A

    Summary:
    This is my Level Unlocking System, allows you to see what been unlocked, beaten and not yet available.

    Tutorial:
    ok so my approach here is we create an object for our buttons and another to control the unlocking. the unlocking variable is just a create event with a variable in it and a button event which we will use for testing. the main work here is done from the level button object. in particular its draw event.

    here is some sample code from the draw event:
    Code:
    // indicate what level is which, if its unlocked or beaten.
    switch(levels){
       case 1:{
           // if we are on level 1 and its unlocked
           if(global.levelUnlock==1){
               image_index = 1; // show unlocked
           } else if(global.levelUnlock>1){ // if we have unlocked more then we must of beat it
               image_index = 2;
           } else image_index = 0; // other wise its lower and still locked
           draw_sprite(level1,image_index,x,y); // show the relevent sprite
           break;
       }
    
       case 2:{
           if(global.levelUnlock==2){
               image_index = 1;
           } else if(global.levelUnlock>2){
               image_index = 2;
           } else image_index = 0;
           draw_sprite(level2,image_index,x,y);
           break;
       }
    }
    
    most of everything else is setting variables. ive include a download link, where you can take a look at it all working. use the space bar to unlock levels.

    The Cons:
    due to how it works, its good only for a linear style format where you play one level and unlock the very next.

    The Pros:
    its very basic so its easy to understand.
     
    Last edited: Jan 19, 2020

Share This Page