Game
Sweet Smash Test-Build 1.03
11 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

Path of Kami: The Evolution of the Lore

I-Buki

Mio-Da!

Ibuki Mioda!

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!

Shuiro Haname. #Commission

Commission for @ShuHaname

Auto-chess meets Clash Royale in an intense strategic battle. Outsmart your opponent, hide your play and crush their armies! Empire Builder just got another major update, check it out! https://gamejolt.com/games/EmpireBuilder/558901

Explosive domino effect

Colorful Fox

Happy Late Easter!

Annie of the stars

Sonic The Hedgehog style Super Smash Bros 4 Pixel art Gif.

ooh yes..