102a9f5a6f
after restart
34 lines
730 B
JavaScript
34 lines
730 B
JavaScript
function exportSaveState() {
|
|
console.log('o')
|
|
var state = {};
|
|
|
|
if(gameState == 1 || gameState == -1 || (gameState == 0 && localStorage.getItem('saveState') !== undefined)) {
|
|
|
|
MainClock.blocks.forEach(function(o){
|
|
o.forEach(function(b){
|
|
b.distFromhex /= settings.scale;
|
|
})
|
|
});
|
|
|
|
blocks.map(function(block){block.distFromHex /= settings.scale})
|
|
state = {
|
|
clock: MainClock,
|
|
blocks: blocks,
|
|
score: score,
|
|
wavegen: waveone,
|
|
gdx: gdx,
|
|
gdy: gdy,
|
|
comboMultiplier:comboMultiplier
|
|
}
|
|
}
|
|
|
|
return JSONfn.stringify(state);
|
|
}
|
|
|
|
function clearSaveState() {
|
|
localStorage.setItem("saveState", "{}");
|
|
}
|
|
|
|
function isStateSaved() {
|
|
return localStorage.getItem("saveState") != "{}";
|
|
}
|