|
|
|
@@ -570,7 +570,7 @@ function clickPopup(text, type, location) { |
|
|
|
} else if (type == "upgrade") { |
|
|
|
direction = -50; |
|
|
|
} else if (type == "info") { |
|
|
|
direction = 50; |
|
|
|
direction = 0; |
|
|
|
} |
|
|
|
|
|
|
|
direction *= Math.random() * 0.5 + 1; |
|
|
|
@@ -684,9 +684,24 @@ window.onload = function() { |
|
|
|
lastTime = performance.now(); |
|
|
|
|
|
|
|
setTimeout(updateDisplay, 1000/updateRate); |
|
|
|
|
|
|
|
setTimeout(autosave, 60000); |
|
|
|
} |
|
|
|
|
|
|
|
function autosave() { |
|
|
|
saveGame(); |
|
|
|
let x = window.innerWidth / 2; |
|
|
|
let y = window.innerHeight * 9 / 10; |
|
|
|
clickPopup("Autosaving...", "info", [x, y]); |
|
|
|
setTimeout(autosave, 60000); |
|
|
|
} |
|
|
|
|
|
|
|
function save(e) { |
|
|
|
saveGame(); |
|
|
|
clickPopup("Saved!", "info", [e.clientX, e.clientY]); |
|
|
|
} |
|
|
|
|
|
|
|
function saveGame() { |
|
|
|
let storage = window.localStorage; |
|
|
|
|
|
|
|
storage.setItem("save-version", "0.0.1"); |
|
|
|
@@ -696,8 +711,6 @@ function save(e) { |
|
|
|
storage.setItem("resources", JSON.stringify(resources)); |
|
|
|
|
|
|
|
storage.setItem("belongings", JSON.stringify(belongings)); |
|
|
|
|
|
|
|
clickPopup("Saved!", "upgrade", [e.clientX, e.clientY]); |
|
|
|
} |
|
|
|
|
|
|
|
function load() { |
|
|
|
|