Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Converts seconds to "MM:SS"
- * @param {float} seconds
- * Takes seconds
- */
- var secondsToTimeString = function (seconds) {
- var s = Math.floor(seconds % 60);
- var m = Math.floor((seconds * 1000 / (1000 * 60)) % 60);
- var strFormat = "MM:SS";
- if (s < 10) s = "0" + s;
- if (m < 10) m = "0" + m;
- strFormat = strFormat.replace(/MM/, m);
- strFormat = strFormat.replace(/SS/, s);
- return strFormat;
- };
- /**
- * Place in update() to get total time since user has started game.
- */
- var elapsedTime = function () {
- var end = new Date();
- var elapsedMS = end.getTime() - start.getTime();
- var seconds = Math.round(elapsedMS / 1000);
- var minutes = Math.round(seconds / 60);
- nCurrentTime = seconds;
- };
- /**
- * All events occuring in Hall One are triggered from this
- */
- var eventsHallOne = function () {
- nCurrentTime = elapsedTime(); // Returns seconds
- switch (nCurrentTime) {
- case 0:
- triggerTrap(camHallOne.c21, camHallOne.c, aStills.HallOne);
- break;
- case 7:
- console.log("Time is: " + nCurrentTime)
- break;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement