remember KGB/Conspiracy? Help me make a clock in AGS, please

Started by , Fri 05/09/2003 04:35:20

Previous topic - Next topic

Horatio Hornblower, R.N.

Dear Forum,

I am attempting to make a "KGB"-like interface, clock and all.  Is it possible to make a clock, that runs, like on a global variable or something in AGS?  If you can me at all, I will be indebted.

Your ob'dt serv't,
Horatio Hornblower, R.N.

Gilbert

Making a clock is easy, for example there was a clock in my old demo.

I never played KGB, so I don't know how it is.
Do you want to make a real-time clock or some pseudo ingame clock by counting game loops?

For real-time clocks, just look at the following script functions from the manual:
GetTime()
GetRawTime()


For pseudo ingame clock, just do in global script:
on top:
Code: ags
int day,hour,minute,second,secloop;


in rep. exec:
Code: ags

secloop++;
if (secloop==2){ //say, advance a second every 2 game loops
  secloop=0;
  second++;
  if (second==60){
     second=0;
     minute++;
     if (minute==60){
        minute=0;
        hour++;
        if (hour==24){
           hour=0;
           day++}
        }
     }
}


You can then access those day, hour, etc. variable to get the time in the game.

SMF spam blocked by CleanTalk