Merge branch 'gh-pages' of http://github.com/teamsnowman/hextris into gh-pages
This commit is contained in:
commit
002fc1132a
3 changed files with 16 additions and 8 deletions
|
@ -98,7 +98,7 @@ keypress.register_combo({
|
|||
keys: "enter",
|
||||
on_keydown: function() {
|
||||
if (gameState==2 || gameState==1) {
|
||||
init();
|
||||
init(1);
|
||||
}
|
||||
if (gameState==0){ gameState=1}
|
||||
}
|
||||
|
|
14
js/main.js
14
js/main.js
|
@ -140,8 +140,11 @@ var startTime;
|
|||
var gameState;
|
||||
setStartScreen();
|
||||
|
||||
function init() {
|
||||
console.log('o');
|
||||
function init(b) {
|
||||
if (b) {
|
||||
clearSaveState();
|
||||
}
|
||||
|
||||
$('#pauseBtn').hide();
|
||||
$('#startBtn').hide();
|
||||
var saveState = localStorage.getItem("saveState") || "{}";
|
||||
|
@ -165,6 +168,7 @@ function init() {
|
|||
if(saveState.blocks) {
|
||||
for(i=0; i<saveState.blocks.length; i++) {
|
||||
block = saveState.blocks[i];
|
||||
block.distFromHex *= settings.scale;
|
||||
blocks.push(block);
|
||||
}
|
||||
}
|
||||
|
@ -186,9 +190,8 @@ function init() {
|
|||
for(i=0; i<MainClock.blocks.length; i++) {
|
||||
for(var j=0; j<MainClock.blocks[i].length; j++) {
|
||||
MainClock.blocks[i][j].height = settings.blockHeight;
|
||||
block = MainClock.blocks[i][j];
|
||||
block.distFromHex = 2 * MainClock.sideLength / Math.sqrt(3) + (j-1) * block.height;
|
||||
block.settled = 0;
|
||||
MainClock.blocks[i][j].settled = 0;
|
||||
MainClock.blocks[i][j].distFromHex *= settings.scale;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +203,6 @@ function init() {
|
|||
|
||||
MainClock.texts = []; //clear texts
|
||||
hideText();
|
||||
debugger;
|
||||
}
|
||||
|
||||
function addNewBlock(blocklane, color, iter, distFromHex, settled) { //last two are optional parameters
|
||||
|
|
|
@ -3,7 +3,13 @@ function exportSaveState() {
|
|||
var state = {};
|
||||
|
||||
if(gameState == 1 || gameState == -1 || (gameState == 0 && localStorage.getItem('saveState') !== undefined)) {
|
||||
MainClock.blocks.map(function(block){block.distFromHex /= settings.scale});
|
||||
|
||||
MainClock.blocks.forEach(function(o){
|
||||
o.forEach(function(b){
|
||||
b.distFromhex /= settings.scale;
|
||||
})
|
||||
});
|
||||
|
||||
blocks.map(function(block){block.distFromHex /= settings.scale})
|
||||
state = {
|
||||
clock: MainClock,
|
||||
|
|
Loading…
Reference in a new issue