gamemaker Unlockable Levels Select Screen



Information about object: obj_control
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.level=1;//set current unlocked level
Step Event:
execute code:

if (keyboard_check_released(vk_left))  {global.level-=1} //for testing
if (keyboard_check_released(vk_right))  {global.level+=1;} //for testing

if global.level==6 {global.level=5;} //keep in range
if global.level==0 {global.level=1;} //keep in range

Draw Event:
execute code:

draw_text(200,50,"Current Level="+string(global.level));//draw current level


Information about object: obj_unlock_level
Sprite: unlocked_level Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Step Event:
execute code:

if position_meeting(mouse_x,mouse_y,id) && mouse_check_button_released(mb_left)//if mouse pressed over button
{
if my_level-1>=global.level//check local vaible against level
{
show_message("Unlocked");
}
else
{
show_message("locked");
}
}

if my_level-1>=global.level//check local vaible against level
{
image_index=0;//set image index
}
else
{
image_index=1;
}
Draw Event:
execute code:

draw_self();
draw_set_halign(fa_center);
draw_text(x,y,my_level);

No comments:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *