28 lines
677 B
JavaScript
28 lines
677 B
JavaScript
function exportSaveState() {
|
|
var state = {};
|
|
|
|
if(gameState == 1 || gameState == -1 || (gameState === 0 && localStorage.getItem('saveState') !== undefined)) {
|
|
state = {
|
|
clock: MainClock,
|
|
blocks: blocks,
|
|
score: score,
|
|
wavegen: waveone,
|
|
gdx: gdx,
|
|
gdy: gdy,
|
|
comboMultiplier:comboMultiplier
|
|
};
|
|
|
|
state.clock.blocks.map(function(i){i.map(function(o){o.distFromHex /= settings.scale})});
|
|
state.blocks.map(function(block){block.distFromHex /= settings.scale;});
|
|
}
|
|
|
|
return JSONfn.stringify(state);
|
|
}
|
|
|
|
function clearSaveState() {
|
|
localStorage.setItem("saveState", "{}");
|
|
}
|
|
|
|
function isStateSaved() {
|
|
return localStorage.getItem("saveState") != "{}";
|
|
}
|