27 lines
770 B
JavaScript
27 lines
770 B
JavaScript
var desktop_mode = false;
|
|
|
|
function prepare_gamestate() {
|
|
var gamestate_loaded = window.localStorage.getItem("gamestate");
|
|
|
|
if (gamestate_loaded == null) {
|
|
record_log("Welcome to Seagull Game! We haven't found a save in your browser storage, so we're starting a new game!");
|
|
gamestate = structuredClone(gamestate_default);
|
|
}
|
|
else {
|
|
gamestate = JSON.parse(gamestate_loaded);
|
|
record_log("Welcome back! Game loaded.")
|
|
}
|
|
}
|
|
|
|
function save_game() {
|
|
window.localStorage.setItem("gamestate", JSON.stringify(gamestate));
|
|
record_log("Game saved.");
|
|
}
|
|
|
|
var tick_meter_running = true;
|
|
|
|
function reset_game() {
|
|
tick_meter_running = false;
|
|
window.localStorage.removeItem("gamestate");
|
|
window.location.reload();
|
|
} |