ASSUMING YOUR FRAME RATE IS 30
First, create a text actor. Now open Global Code and type the following:
- Code: Select all
int fm, time[3];
Now in CreateActor of the Text Actor, lets place this code:
- Code: Select all
fm=3600;
At the moment, this is 2 minutes. Use a calculator to determine how long you want, by doing this kind of method
CALCULATOR:
60*60*60, seconds, minutes, hours. 60*60 is 3600, you have 2 60's, meaning its equal up to 2 minutes, because 60 seconds is 1 minute. If you want more than that, you'd type this in a calculator:
- Code: Select all
60*60*5
This equals 18000, meaning 5 minutes. if you want an hour, you'd type 60*60*60, and if you want say... 5 hours, you'd type 60*60*60*5 which means 1080000 frames. IF you want to use SECONDS, then you'd do this: 30*seconds, for example: 30*12 which is 360 frames, which means 12 seconds.
Finally, go to draw actor and read through this commented code
- Code: Select all
xscreen=0;
yscreen=0;
//if the frame is greater than or equal to 1, frame is subtracted by 1
fm>=1 && fm--;
// set up where seconds mniutes and hours add up and reset.
//Seconds:
time[0]=fm/30-(time[1]*60); //if frame is set to 30, add by 1, and if minut is 1, reset to 0;
//Minutes:
time[1]=fm/(30*60)-(time[2]*60); //if 60 seconds, add minute by 1, if hour incraeses, reset minutes to 0
//Hours
time[2]=fm/(30*(60*60)); //add an hour when 60 minutes have been added.
//Place the text:
sprintf(text, "%d : %d : %d", time[0], time[1], time[2]);
//when time is ran up, use a script, in this case,
//type Time Up on the screen.
fm<=0 && sprintf(text, "Time Up!");
Now you should be set