fixed start btn not starting saved games, removed useless debugging lines

This commit is contained in:
lengstrom 2014-06-28 11:48:45 -04:00
parent 2f2ad3b7ae
commit a7293a1d48
3 changed files with 8 additions and 7 deletions

View file

@ -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";

View file

@ -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();

View file

@ -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,