fixed start btn not starting saved games, removed useless debugging lines
This commit is contained in:
parent
2f2ad3b7ae
commit
a7293a1d48
3 changed files with 8 additions and 7 deletions
|
@ -51,6 +51,9 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
//slate for final deletion
|
||||
this.opacity = 0;
|
||||
this.deleted = 2;
|
||||
if (gameState == 1) {
|
||||
localStorage.setItem("saveState", exportSaveState());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -141,6 +144,9 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
|
||||
if (this.tint) {
|
||||
if (this.opacity < 1) {
|
||||
if (gameState == 1) {
|
||||
localStorage.setItem("saveState", exportSaveState());
|
||||
}
|
||||
this.tint = 0;
|
||||
}
|
||||
ctx.fillStyle = "#FFF";
|
||||
|
|
|
@ -5,6 +5,8 @@ $(document).ready(function(){
|
|||
$('#startBtn').on('touchstart mousedown', function(){
|
||||
if (importing == 1) {
|
||||
init(1);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
|
||||
setTimeout(function(){
|
||||
|
@ -20,9 +22,6 @@ $(document).ready(function(){
|
|||
});
|
||||
|
||||
$(window).resize(scaleCanvas);
|
||||
$(window).unload(function() {
|
||||
localStorage.setItem("saveState", exportSaveState());
|
||||
});
|
||||
|
||||
function scaleCanvas() {
|
||||
canvas.width = $(window).width();
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
function exportSaveState() {
|
||||
console.log('o')
|
||||
debugger;
|
||||
var state = {};
|
||||
|
||||
if(gameState == 1 || gameState == -1 || (gameState === 0 && localStorage.getItem('saveState') !== undefined)) {
|
||||
console.log(MainClock.blocks[5][0].distFromHex);
|
||||
MainClock.blocks.map(function(i){i.map(function(o){o.distFromHex /= settings.scale})});
|
||||
console.log(MainClock.blocks[5][0].distFromHex);
|
||||
blocks.map(function(block){block.distFromHex /= settings.scale;});
|
||||
state = {
|
||||
clock: MainClock,
|
||||
|
|
Loading…
Reference in a new issue