【GAMEMAKER】Toggle quest complete

 Information about object: obj_example

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

///Set Up Data
quest[1,1]="Collect 100 Treasure Chests"; //name of quest
quest[1,2]=false; //whether completed (true) or not completed (false);

quest[2,1]="Defeat All Bosses"; //name of quest
quest[2,2]=true; //whether completed (true) or not completed (false);

quest[3,1]="Puzzle Room"; //name of quest
quest[3,2]=false; //whether completed (true) or not completed (false);

quest[4,1]="Find All Hidden Locations"; //name of quest
quest[4,2]=false; //whether completed (true) or not completed (false);

Step Event:
execute code:

///toggle completion true / false
//for example only
if keyboard_check_pressed(ord('1'))
{
    quest[1,2]=!quest[1,2]
}

if keyboard_check_pressed(ord('2'))
{
    quest[2,2]=!quest[2,2]
}

if keyboard_check_pressed(ord('3'))
{
    quest[3,2]=!quest[3,2]
}

if keyboard_check_pressed(ord('4'))
{
    quest[4,2]=!quest[4,2]
}
Draw Event:
execute code:

for (var loop = 1; loop <=4; loop += 1)
{
    //set drawing colour based on true/false
    if quest[loop,2]
    {
        draw_set_colour(c_green);
    }
    else
    {
        draw_set_colour(c_red); 
    }
    //draw description
    draw_text(10,100+(loop*100),quest[loop,1]);
    //draw completed or not
    if quest[loop,2]
    {
        draw_text(500,100+(loop*100),"Completed");
    }
    else
    {
        draw_text(500,100+(loop*100),"Not Completed");
    }
    
}

draw_set_colour(c_black);
draw_text(10,700,"Press 1 2 3 4 To Toggle");

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 *