2014-05-26 05:11:47 +00:00
|
|
|
var grey = '#bdc3c7';
|
2014-05-31 01:05:01 +00:00
|
|
|
op=0;
|
2014-05-30 23:06:16 +00:00
|
|
|
var saveState = localStorage.getItem("saveState") || "{}";
|
|
|
|
if(saveState !== "{}"){op=1;}
|
2014-05-26 01:49:03 +00:00
|
|
|
function render() {
|
|
|
|
ctx.clearRect(0, 0, trueCanvas.width, trueCanvas.height);
|
|
|
|
clearGameBoard();
|
2014-06-01 00:10:32 +00:00
|
|
|
if (gameState == 1 || gameState ==2 || gameState == -1) {
|
2014-05-26 18:43:05 +00:00
|
|
|
if (op < 1) {
|
|
|
|
op += 0.01;
|
2014-05-26 01:49:03 +00:00
|
|
|
}
|
2014-05-26 18:43:05 +00:00
|
|
|
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);
|
|
|
|
ctx.globalAlpha = 1;
|
2014-05-26 01:49:03 +00:00
|
|
|
}
|
2014-05-26 15:22:52 +00:00
|
|
|
|
2014-05-26 01:49:03 +00:00
|
|
|
for (var i in MainClock.blocks) {
|
|
|
|
for (var j = 0; j < MainClock.blocks[i].length; j++) {
|
|
|
|
var block = MainClock.blocks[i][j];
|
|
|
|
block.draw(true, j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i in blocks) {
|
|
|
|
blocks[i].draw();
|
|
|
|
}
|
|
|
|
|
2014-05-26 15:22:52 +00:00
|
|
|
|
2014-05-26 01:49:03 +00:00
|
|
|
MainClock.draw();
|
2014-06-01 00:10:32 +00:00
|
|
|
if ( gameState ==1 | gameState ==-1 ) {
|
2014-05-26 03:42:06 +00:00
|
|
|
drawScoreboard();
|
|
|
|
}
|
2014-05-26 16:27:30 +00:00
|
|
|
for (var i in MainClock.texts) {
|
|
|
|
var alive = MainClock.texts[i].draw();
|
|
|
|
if(!alive){
|
|
|
|
MainClock.texts.splice(i,1)
|
|
|
|
}
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
|
2014-05-26 01:49:03 +00:00
|
|
|
settings.prevScale = settings.scale;
|
2014-06-04 18:33:40 +00:00
|
|
|
settings.hexWidth = settings.baseHexWidth * settings.scale;
|
|
|
|
settings.blockHeight = settings.baseBlockHeight * settings.scale;
|
2014-05-26 01:49:03 +00:00
|
|
|
}
|