From c8c7cd25c963b1eefb98bf58a29c08c932c233f6 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 14 May 2016 20:29:03 -0500 Subject: [PATCH] Track play time on the title screen when's 100% attempts --- main/Game.js | 1 + other/Memory.js | 1 + other/Title.js | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/main/Game.js b/main/Game.js index c980e7b..2bc97d5 100644 --- a/main/Game.js +++ b/main/Game.js @@ -28,6 +28,7 @@ Game = (function() { requestAnimationFrame(gameLoop); Input.refresh(); + Memory.global.time++; flipScenes(); currentScene.ticCount++; diff --git a/other/Memory.js b/other/Memory.js index 3ee3ffa..be397aa 100644 --- a/other/Memory.js +++ b/other/Memory.js @@ -10,6 +10,7 @@ Memory = (function() { global: { keys: [], + time: 0, }, }; diff --git a/other/Title.js b/other/Title.js index 7ceefb6..66dcf47 100644 --- a/other/Title.js +++ b/other/Title.js @@ -117,7 +117,16 @@ Title = function() { "Save 5": "Closure", }; - menu[2].text = "Slot: " + Memory.slot + " - " + (file ? list[file.lastStage] : "EMPTY"); + var playtime = "0:00"; + + if (file && file.global.time) { + playtime = Math.floor(file.global.time / 3600) + ":" + + (Math.floor(file.global.time / 600) % 10) + "" + + (Math.floor(file.global.time / 60) % 10); + } + + menu[2].text = "Slot: " + Memory.slot + " - " + (file ? list[file.lastStage] : "EMPTY") + + " (" + playtime + ")"; } }