Hi there. I've been trying to wrap my head aound this seemingly simple problem. I am write a game and I need to show on the screen the number of seconds the game has been playing for. This is the best way I can come up with but it doesn't want to update with the new values.
int sec = 0;
int min = 0;
timer_id gameTimer = create_timer(1000);
if (timer_expired( gameTimer) )
{
sec = sec + 1;
if (sec == 60)
{
sec = 0;
min = min + 1;
}
}
draw_int( screen_width()/2, screen_height()/2, sec);
draw_int( screen_width()/2, screen_height()/2+2, min);
The last two lines don't mean anything, they are just there to check if it worked. Thank you