954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how can countdown-timer and game work at the same time!?

is it possible?
i would like create Q&A game with a countdown-timer.
if timer=0 then stop the game.

how can i do this? Thank you

tky
Newbie Poster
5 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

Just use a TTimer or please be more specific with your question.

MasterXP
Newbie Poster
1 post since Jun 2011
Reputation Points: 10
Solved Threads: 1
 
pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

Sorry...i am the beginner
i don't know what Tobject is.
Can Pascal do this!? i'm not using Delphi.

Program test;
Uses Crt;

procedure timer(d:integer;var t:byte);
Var i:Byte;  {0..255}
Begin
         Dec(t);{decrease value of 'i' by 1}
         Delay(d); {waiting d millisec}

End;

var time:byte;
begin
time:=60;
repeat
 clrscr;
    writeln('Time: ',time );
    timer(1000,time);
until time=0;

end.


Can i use above code add into the game ?

tky
Newbie Poster
5 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

No you would check against real time in game loop, not use delay doing nothing.

pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

oh..i see
have any samples!?
i have not any concept to write.
thank you

tky
Newbie Poster
5 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

Is this solved? The snippet I posted should explain the strategy.

pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

OH....i saw the post.
it is solved.
thank for your help.

tky
Newbie Poster
5 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

Mark then the thread solved from the link at end of thread.

pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

Which post you had seen for solved the question ?

qqaa1122
Newbie Poster
1 post since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You