Computer Science Canada

keeping track of time for a turn based game?

Author:  threatbinder [ Thu Dec 17, 2009 8:32 pm ]
Post subject:  keeping track of time for a turn based game?

Time.Elapsed is since the program is run, so how could I do a per turn timer, make it reset every turn back to a certain number in seconds? I tried looking at all the time functions, and they're all pretty useless.. why do we need to know the amount of seconds since 1970? lol

Author:  apomb [ Thu Dec 17, 2009 9:09 pm ]
Post subject:  RE:keeping track of time for a turn based game?

possibly take a look at Time.Delaysincelast in conjunction with Time.Elapsed will allow a process to take a certain amount of time, instead of simply delay() which could be different on different machines.

Author:  Tony [ Thu Dec 17, 2009 10:33 pm ]
Post subject:  Re: keeping track of time for a turn based game?

threatbinder @ Thu Dec 17, 2009 8:32 pm wrote:
why do we need to know the amount of seconds since 1970? lol

The Universe started on January 1st, 1970. Anyone to says they are over 39 years old is lying about their age.

http://xkcd.com/376/

Author:  mirhagk [ Fri Dec 18, 2009 12:43 am ]
Post subject:  RE:keeping track of time for a turn based game?

k so at the beginning of the turn you record the time in a variable, let's call it t. then the amount of time the turn is taking is Time.Elapsed-t


: