Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// @description game_timer_new()
- function game_timer_new() {
- //Local variables for calculating the time
- var hour, minute, second, centisecond;
- //Local variables for displaying the time
- var d_hour, d_minute, d_second, d_centisecond;
- var local_limit = 604000000000;
- var global_limit = 362440000000;
- if (global.currentTime < local_limit)
- global.currentTime += delta_time;
- if (global.globalTime < global_limit)
- global.globalTime += delta_time;
- //Calculate each section of the timer
- var time_to_calculate = global.gameTimer == 1 ? global.currentTime : global.globalTime;
- centisecond = floor(time_to_calculate / 10000) % 100;
- second = floor((time_to_calculate / 10000) / 100) % 60;
- minute = floor(((time_to_calculate / 10000) / 100) / 60) % 60;
- hour = floor((((time_to_calculate / 10000) / 100) / 60) / 60) % 60;
- //Display correct time
- d_hour = global.gameTimer == 1 ? "" : zfill(hour, 2);
- d_minute = zfill(minute, 2);
- d_second = zfill(second, 2);
- d_centisecond = zfill(centisecond, 2);
- //Return values
- return [d_hour, d_minute, d_second, d_centisecond];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement