T
traparvvaves
Guest
Hello, I am relatively new to programming in GameMaker. I am currently working on a part where if you press a key, a countdown timer will appear on the screen. However, I haven't had much luck in having it update. When I press the A key, it does show that there is 5 seconds on the clock, but it doesn't draw the countdown. This is the code I have for it:
CREATE EVENT:
STEP EVENT:
DRAW GUI EVENT:
Can anyone help me with this? Thank you!
CREATE EVENT:
Code:
global.battery = 1;
countdown_time = 5.0;
rounded_time = 0;
Code:
if keyboard_check_released(ord('A')) {
if global.battery > 0 {
if (countdown_time > 0) {
time = delta_time/1000000;
countdown_time -= time;
rounded_time = round(countdown_time);
}
else {
countdown_time = 0;
show_message(countdown_time);
}
}
else {
show_message("No batteries collected.");
}
}
Code:
draw_text(32,32, rounded_time);