reverted changes around transition from start screen -> gameplay

This commit is contained in:
meadowstream 2014-06-28 14:34:30 -04:00
parent b3aac51fd3
commit b07a0a140c
3 changed files with 45 additions and 89 deletions

View file

@ -129,6 +129,10 @@ function Clock(sideLength) {
};
this.draw = function() {
if (this.opacity < 1) {
ctx.globalAlpha = this.opacity;
}
this.x = trueCanvas.width/2;
if (gameState != -2) {
@ -155,7 +159,8 @@ function Clock(sideLength) {
this.angle += this.angularVelocity;
}
drawPolygon(this.x + gdx, this.y + gdy + this.dy, this.sides, this.sideLength, this.angle,arrayToColor(this.fillColor) , 0, 'rgba(0,0,0,0)');
drawPolygon(this.x + gdx, this.y + gdy + this.dy, this.sides, this.sideLength, this.angle,arrayToColor(this.fillColor) , 0, 'rgba(0,0,0,0)');
ctx.globalAlpha = 1;
};
}

View file

@ -292,58 +292,6 @@ function stepInitialLoad() {
}
}
function checkIfAllAreDeleted() {
var indicator = 2;
blocks.forEach(function(o){
if (o.deleted === 0) {
return 0;
}
if (o.deleted == 1) {
indicator = 1;
}
});
for (var i = 0; i < MainClock.blocks.length; i++) {
MainClock.blocks[i].forEach(function(o){
if (o.deleted === 0) {
return 0;
}
if (o.deleted == 1) {
indicator = 1;
}
});
}
return indicator;
}
function fadeOutObjectsOnScreen() {
switch (checkIfAllAreDeleted()) {
case 0:
importing = 0;
MainClock.blocks.map(function(i){
i.map(function(o){
o.deleted = 1;
});
});
blocks.map(function(o){
o.deleted = 1;
});
break;
case 1:
break;
case 2:
MainClock.blocks = [[],[],[],[],[],[]];
blocks = [];
break;
}
}
function setStartScreen() {
$('#startBtn').show();
if (!isStateSaved()) {

View file

@ -2,44 +2,47 @@ op=0;
var saveState = localStorage.getItem("saveState") || "{}";
if(saveState !== "{}"){op=1;}
function render() {
var grey = '#bdc3c7';
if (gameState === 0) {
grey = "rgb(220, 223, 225)";
}
ctx.clearRect(0, 0, trueCanvas.width, trueCanvas.height);
clearGameBoard();
if (gameState === 1 || gameState === 2 || gameState === -1 || gameState === 0) {
if (op < 1) {
op += 0.01;
}
ctx.globalAlpha = op;
drawPolygon(trueCanvas.width / 2 , trueCanvas.height / 2 , 6, (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth, 30, grey, false,6);
drawTimer();
ctx.globalAlpha = 1;
}
var i;
for (i = 0; i < MainClock.blocks.length; i++) {
for (var j = 0; j < MainClock.blocks[i].length; j++) {
var block = MainClock.blocks[i][j];
block.draw(true, j);
}
}
var grey = '#bdc3c7';
if (gameState === 0) {
grey = "rgb(220, 223, 225)";
}
ctx.clearRect(0, 0, trueCanvas.width, trueCanvas.height);
clearGameBoard();
if (gameState === 1 || gameState === 2 || gameState === -1 || gameState === 0) {
if (op < 1) {
op += 0.01;
}
ctx.globalAlpha = op;
drawPolygon(trueCanvas.width / 2 , trueCanvas.height / 2 , 6, (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth, 30, grey, false,6);
drawTimer();
ctx.globalAlpha = 1;
}
for (i = 0; i < blocks.length; i++) {
blocks[i].draw();
}
var i;
for (i = 0; i < MainClock.blocks.length; i++) {
for (var j = 0; j < MainClock.blocks[i].length; j++) {
var block = MainClock.blocks[i][j];
block.draw(true, j);
}
}
MainClock.draw();
if (gameState ==1 || gameState ==-1 || gameState == 0) {
drawScoreboard();
}
for (i = 0; i < MainClock.texts.length; i++) {
var alive = MainClock.texts[i].draw();
if(!alive){
MainClock.texts.splice(i,1);
i--;
}
}
for (i = 0; i < blocks.length; i++) {
blocks[i].draw();
}
MainClock.draw();
if (gameState ==1 || gameState ==-1 || gameState === 0) {
drawScoreboard();
}
for (i = 0; i < MainClock.texts.length; i++) {
var alive = MainClock.texts[i].draw();
if(!alive){
MainClock.texts.splice(i,1);
i--;
}
}
settings.prevScale = settings.scale;
settings.hexWidth = settings.baseHexWidth * settings.scale;