Game
Sweet Smash Test-Build 1.03
12 years ago

How I created my games timer in Game Maker :Studio (standard edition)


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

Loading...

Next up

This Satuday we invite to watch another #speedpainting of our artist Daniel Faiad.

How great is this scene of #Pecaminosa?

#ScreenShotSaturday | #IndieDev | #DigitalArt

So

i may or may not make an full art of some person or i may just leave this like that-

Bandana Dee the Dream Friend

art comission.

Shoobies leave a sticky trail of mucus in their wake, which can impede movement for any creature that steps in it.

Fan art for Foolish I'm feeling kinda better so I drew this

Shadow The Hedgehog X pixel art

Protege el conocimiento, salva la historia. Guardian of Lore es un platformer 2D en el que debes luchar para mantener viva la memoria de la mitología latinoamericana. El juego llegará a Steam el 18 de mayo: https://steam.pm/app/1211740 #ScreenshotSaturday