Here’s a quick bit of code incase anyone was wondering how i made the timer in my game :)
In a create event:
global.seconds = 0;
global.minutes = 0;
global.hours =0;
In a step event:
if (global.count_up == true)
{
global.seconds += 1/room_speed;
}
if (global.seconds < 60 ) && (global.seconds > 59.9)
{
global.seconds = 0;
global.minutes += 1;
}
if (global.minutes ==60)
{
global.minutes = 0;
global.hours += 1;
}
In a room start event:
NOTE: This is just to set the font and the colour of the text in your game, if left will be ariel (i think)
Font = font_add_sprite(spr_font, ord(” “), 1, 1);
draw_set_color(c_white);
In the Draw Event:
draw_set_font(Font);
if (global.seconds < 10 ) && (global.minutes <10)
{
draw_text (350,32, “0” +string(global.hours) + “:0” + string(global.minutes) + “:0” + string(global.seconds));
}
if (global.seconds >= 10) && (global.minutes >=10)
{
draw_text (350,32, “0” +string(global.hours) + “:” + string(global.minutes) + “:0” +string(global.seconds));
}
else if (global.seconds < 10) && (global.minutes >=10)
{
draw_text (350,32, “0” +string(global.hours) + “:” + string(global.minutes) + “:0” + string(global.seconds));
}
else if (global.seconds >= 10) && (global.minutes < 10)
{
draw_text (350,32, “0” +string(global.hours)+ “:0” + string(global.minutes) + “:” + string(global.seconds));
}
That’s all for yesterday! I’ll keep the blog updated on current progress that i make in the next few days.










0 comments