Programming: how to make a countdown

Status
Not open for further replies.

GolRouge D

Estimable
Jul 26, 2015
2
0
4,510
so ive been doing some school related stuff , and in some parts i need a countdown timer in my game. I ve been coding in code blocks. . so how do or how can i code a countdown timer for my game
 

kanewolf

Judicious
Moderator
Usually the language you are using has a timer available. You set it up to asynchronously notifiy you when the timer expires. If something happens in your game that should reset the timer, you cancel it and start a new timer when needed. If you get the timer interrupt, then you take appropriate steps.
 

GolRouge D

Estimable
Jul 26, 2015
2
0
4,510


i dont meant to be annoying
but what I mean is. for example in my game. theres a question that need to be answer in 30 seconds. if you fail to answer in given time , the other player will have the chance to answer.
 

kanewolf

Judicious
Moderator


And that is EXACTLY what I answered. You will need to find a timer function in the language you are using. It should have the capability to send you an interrupt when the timer goes off (30 second). If you get that interrupt BEFORE you get an answer then you execute the code to switch the option to the other player. If you get a response you process that response.
 
Status
Not open for further replies.