problem with time

Started by Brezo, Mon 23/11/2009 17:14:30

Previous topic - Next topic

Brezo

I want start up an accountant of time (a chronometer) for the presentation and small puzzle that I want to include. Since one becomes? It is necessary to program?
 
Sorry for my english, but i am spanish  ;D

suicidal pencil

#1
yes, programing is required. You'd need to keep track of the seconds in time with a variable, and figure out how many minutes (if it takes that long)

Code: ags

int Loops = 0;
int Seconds = 0;
int Minutes = 0;

function repeatedly_execute()
{
  Loops++
  if(Loops == 40) Seconds++;
  Change_Time(Seconds);
}

Change_Time(int time)
{
  if(time == 60)
  {
     Minutes++;
     Second = 0;
     Label1.Text = String.Format("%d:00", Minutes);
     return 0;
  }
  else
  {
     Label1.Text = String.Format("%d:%d", Minutes, Seconds);
     return 0;
  }
}

Brezo


Calin Leafshade

The above code will make time move 40 times faster (or what ever the game speed)

Remember that rep_ex runs every game loop, not every second.

suicidal pencil

Quote from: Calin Leafshade on Thu 26/11/2009 18:58:27
The above code will make time move 40 times faster (or what ever the game speed)

Remember that rep_ex runs every game loop, not every second.

updated :)

SMF spam blocked by CleanTalk