Make Video Games 2018 ►

In this video we learn how to create levels that we can unlock once we have completed the level before. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

I’m the founder of codingmadesimple.com that hosts high quality, fun to learn and straight to the point course material for game developers. I’d really appreciate it if you’d check out my content.

Twitter ►
Google+ ►
Patreon ►

Have fun learning!

Nguồn: https://shaarique.com/

Xem thêm bài viết khác: https://shaarique.com/game/

26 Comments

Karnage Gaming

July 7, 2020

this is brilliant. will need a bit of tweeking to avoid unlocking other levels if u play it more then once. and maybe some changes so graphic of level shows its locked or unlocked state. but aside from that great tutorial

Reply

Lolliross

July 7, 2020

it is 2018 and this no longer works.. think its time for an update?

Reply

Anantha Tekklur

July 7, 2020

Will this not work with Gamemaker 2?

Reply

Dragos Ilies

July 7, 2020

If you do not want to unlock a level when playing the old ones, replace UNLOCK += 1 code with this script I made:
switch (global.LEVEL_UNLOCKED)
{
case 2:
if (room == rm_level1) // Change the room with your room and so on..
{show_message('Do not grow')}
else
{global.LEVEL_UNLOCKED += 1; show_message('GROW it boy');}
break;

case 3:
if (room == rm_level2)
{show_message('Do not grow')}
else
{global.LEVEL_UNLOCKED += 1; show_message('GROW it boy');}
break;

default: global.LEVEL_UNLOCKED += 1;
show_message('GROW it boy');
}

Is ugly but it works, at least for me.

Reply

Purple Coffin Man

July 7, 2020

What do you code in in terms of getting the levels into this?

Reply

yxnnic__

July 7, 2020

Help

Variable obj_LevelSystem.level(100021, -2147483648) not set before reading it.
at gml_Object_obj_LevelSystem_CreateEvent_1 (line 3) – switch(level){
############################################################################################

Reply

me mine

July 7, 2020

no i gave up on this tutorial maybe its not for gms 1.4 as well.

Reply

me mine

July 7, 2020

my error seems to do with switch(level) it cant find the variable . i set it to each level number in creation code of each id in room but i still get that error so i went with placing it in room start event (not create event) and the error was gone but room start event doent seem to change image_indexs to each ids level strange any feedback would be welcome Thanks

Reply

me mine

July 7, 2020

hmm i see your tutorial is done in gms html5 old version IS THAT WHY IT DOESNT WORK IN STUDIO HAS STUDIO CHANGED SOMETHING WITH ID CODE FROM HTML5 OLD VERSION I DID ALL CORRECT FROM YOUR TUTORIAL BUT IT DOESNT WORK IN STUDIO so my question is does this way work for studio as well Thanks for any help you can give

Reply

Justin Moro

July 7, 2020

i cant find the creation code for the objects

Reply

XxRazor1320xX

July 7, 2020

I'm having issues attaching the global.LEVEL_UNLOCKED += 1; to a door. although the player has had a collision with the door to activate the code it wont say the level has been unlocked. i attached it to the spacebar as shown in the video and it seemed to work, any ideas why it wont work?

Reply

Syafique Azraei

July 7, 2020

YOUR VIDEOS ARE SO CONFUSING!!!!!!! CAN'T YOU TAKE IT SLOW!!??!!

Reply

manpreet singh

July 7, 2020

hey .. i want little help ..
my problem is :
if i unlock all 3 levels then i play again level 1 the other levels are locked again … can you help me my project is almost complete only that thing left

Reply

CHAU YEN

July 7, 2020

Would you please read it and help me, please:
Can you please help me to complete the project:
I want to do a level of gameplay systems,
– The main room includes room 1 (unlocked), room 2 (not unlock), room 3 (not unlock), room 4 (not unlock), …
– Room 1: When players kill all enemies then automatically switches to the main room and unlocked the room and 2.
– In room 2 when unlocked, players can enter the room 2. Now players continue to kill all the enemies in room 2, it will automatically switch to the main room and simultaneously unlock the room 3.
– And so it goes on …

Reply

Philip II of Spain

July 7, 2020

How do I make so if I press a button , I go to a room? I must skip 20 rooms for each level…

Reply

Dinou YT

July 7, 2020

how to get this long script plzzzzz

Reply

SJStudio

July 7, 2020

Getting this error. Pls help
_________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object obj_LevelSysteem:
Push :: Execution Error – Variable Get 100242.level(100008, -2147483648)
 at gml_Object_obj_LevelSysteem_CreateEvent_1 (line 3) – switch(level){
############################################################################################

Reply

StigPing

July 7, 2020

global.LEVEL_UNLOCKED += 1;
Crashes my game.

_________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Key Press Event for <Space> Key
for object obj_data:

Push :: Execution Error – Variable Get -5.LEVEL_UNLOCKED(100051, -2147483648)
 at gml_Object_obj_data_KeyPressed_SPACE_1 (line 1) – global.LEVEL_UNLOCKED += 1;
############################################################################################

Reply

beatsbyyaoming

July 7, 2020

For those having problems when pressing space and EVERY level unlocks.. instead of global.LEVELUNLOCKED +=1. do global.LEVELUNLOCKED = 2

that will only unlock level 2, if you want to unlock level 3 do global.LEVELUNLOCKED = 3. etc

Reply

PIXEL GOOMBAH

July 7, 2020

A when i press space all of them unlock so i need help some one please help me

Reply

PIXEL GOOMBAH

July 7, 2020

how do you do like a mega man version like you need to beat 6 level to unlock the last but you can choose which order you want

Reply

Jonahrobot

July 7, 2020

also could you do a saving tutorial for this like if you leave the game it saves your progress.

Reply

Jonahrobot

July 7, 2020

so i added a system like this in my game but if i go back to one of my levels and win it again the count still goes up and the next level is unlocked even if i beat the first level? How do i get it so if i beat the level and go back and beat it again it will not add to the global.room_unlock var again? Is there a way to fix this?

Reply

Aaron Wise

July 7, 2020

is there a way of doing this without switch and case? because it always throws errors at me when i follow the tutorial video and try it for myself…

Reply

Rextrem Fael

July 7, 2020

when i press space all levels are unlocked.
script "left pressed":
switch(level){

case 0:{
    if (global.LEVEL_UNLOCKED >= 1) {
    show_message("LEVEL 1")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 1:{
    if (global.LEVEL_UNLOCKED >= 2) {
    show_message("LEVEL 2")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 2:{
    if (global.LEVEL_UNLOCKED >= 3) {
    show_message("LEVEL 3")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 3:{
    if (global.LEVEL_UNLOCKED >= 4) {
    show_message("LEVEL 4")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 4:{
    if (global.LEVEL_UNLOCKED >= 5) {
    show_message("LEVEL 5")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 5:{
    if (global.LEVEL_UNLOCKED >= 6) {
    show_message("LEVEL 6")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 6:{
    if (global.LEVEL_UNLOCKED >= 7) {
    show_message("LEVEL 7")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 7:{
    if (global.LEVEL_UNLOCKED >= 8) {
    show_message("LEVEL 8")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 8:{
    if (global.LEVEL_UNLOCKED >= 9) {
    show_message("LEVEL 9")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 9:{
    if (global.LEVEL_UNLOCKED >= 10) {
    show_message("LEVEL 10")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
case 10:{
    if (global.LEVEL_UNLOCKED >= 11) {
    show_message("LEVEL BOSS")
    }else show_message("LEVEL NOT UNLOCKED");
    break;
}
}
script "space press":
global.LEVEL_UNLOCKED += 1;
Help please

Reply

Bloodman42

July 7, 2020

May someone help me?
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object obj_level_selection:

Push :: Execution Error – Variable Get -1.level(100016, -1)
 at gml_Object_obj_level_selection_CreateEvent_1 (line 5) – case 0:{
############################################################################################

Reply

Leave a Reply