fixed bottom bar connectivity issues. fixed instruction text appearing in the pause screen. fixed buttons appearing in the end game screen
This commit is contained in:
parent
1f135f3bd4
commit
ca09916ca2
3 changed files with 43 additions and 25 deletions
|
@ -1,19 +1,28 @@
|
|||
|
||||
$(document).ready(function(){
|
||||
initialize();
|
||||
hidebottombar();
|
||||
$('#bottombar').hide();
|
||||
});
|
||||
|
||||
function showbottombar() {
|
||||
$('#bottombar').show();
|
||||
var isOffline = 'onLine' in navigator && !navigator.onLine;
|
||||
if (isOffline) {
|
||||
alert('offline!');
|
||||
setTimeout(showbottombar, 1000);
|
||||
} else {
|
||||
window.iframeHasLoaded = true;
|
||||
if (!(gameState == 1 || gameState == 2)) {
|
||||
$('#bottombar').fadeIn(150, 'linear');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hidebottombar() {
|
||||
$('#bottombar').hide();
|
||||
$('#bottombar').fadeOut(150, 'linear');
|
||||
}
|
||||
|
||||
function initialize(a) {
|
||||
//view.js
|
||||
window.iframHasLoaded = false;
|
||||
window.colors = ["#e74c3c", "#f1c40f", "#3498db", "#2ecc71"];
|
||||
window.hexColorsToTintedColors = {
|
||||
"#e74c3c":"rgb(241,163,155)",
|
||||
|
|
29
js/main.js
29
js/main.js
|
@ -1,4 +1,4 @@
|
|||
function scaleCanvas() {
|
||||
function scaleCanvas() {
|
||||
canvas.width = $(window).width();
|
||||
canvas.height = $(window).height();
|
||||
|
||||
|
@ -48,9 +48,14 @@ function resumeGame() {
|
|||
$('.helpText').fadeOut(150, "linear");
|
||||
}
|
||||
}, 7000);
|
||||
if ($('#helpScreen').is(":visible")) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
checkVisualElements();
|
||||
}
|
||||
|
||||
function checkVisualElements() {
|
||||
if (!$('.helpText').is(":visible")) $('.helpText').fadeIn(150, "linear");
|
||||
if (!$('#pauseBtn').is(':visible')) $('#pauseBtn').fadeIn(150, "linear");
|
||||
if (!$('#restartBtn').is(':visible')) $('#restartBtn').fadeIn(150, "linear");
|
||||
}
|
||||
|
||||
function hideUIElements() {
|
||||
|
@ -64,13 +69,13 @@ function hideUIElements() {
|
|||
function init(b) {
|
||||
if (b) {
|
||||
hidebottombar();
|
||||
if (!$('.helpText').is(":visible")) {
|
||||
$('.helpText').fadeIn(150, "linear");
|
||||
}
|
||||
|
||||
|
||||
if ($('#helpScreen').is(":visible")) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
checkVisualElements();
|
||||
|
||||
setTimeout(function() {
|
||||
$('.helpText').fadeOut(150, "linear");
|
||||
|
@ -191,7 +196,7 @@ function setStartScreen() {
|
|||
$('#restartBtn').show();
|
||||
$('#startBtn').show();
|
||||
$('#attributions').show();
|
||||
$("#bottombar").show();
|
||||
showbottombar()
|
||||
|
||||
gameState = 0;
|
||||
requestAnimFrame(animLoop);
|
||||
|
@ -221,15 +226,19 @@ function animLoop() {
|
|||
}
|
||||
render();
|
||||
if (checkGameOver() && !importing) {
|
||||
$('.helpText').fadeIn(200, "linear");
|
||||
gameState = 2;
|
||||
setTimeout(function(){
|
||||
enableRestart();
|
||||
}, 200);
|
||||
}, 150);
|
||||
|
||||
if ($('#helpScreen').is(':visible')) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
if ($('.helpText').is(":visible")) $('.helpText').fadeOut(150, "linear");
|
||||
if ($('#pauseBtn').is(':visible')) $('#pauseBtn').fadeOut(150, "linear");
|
||||
if ($('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
|
||||
|
||||
showbottombar();
|
||||
canRestart = 0;
|
||||
clearSaveState();
|
||||
|
|
22
js/render.js
22
js/render.js
|
@ -41,17 +41,6 @@ function render() {
|
|||
}
|
||||
}
|
||||
|
||||
if (gameState == -1) {
|
||||
ctx.globalAlpha = 0.9;
|
||||
ctx.fillStyle = 'rgb(236,240,241)';
|
||||
ctx.fillRect(0, 0, trueCanvas.width, trueCanvas.height);
|
||||
ctx.globalAlpha = 1;
|
||||
}
|
||||
|
||||
settings.prevScale = settings.scale;
|
||||
settings.hexWidth = settings.baseHexWidth * settings.scale;
|
||||
settings.blockHeight = settings.baseBlockHeight * settings.scale;
|
||||
|
||||
if ((MainHex.ct < 400 && (gameState !== 0) && !MainHex.playThrough)) {
|
||||
if (MainHex.ct > 350) {
|
||||
ctx.globalAlpha = (50 - (MainHex.ct - 350))/50;
|
||||
|
@ -64,6 +53,17 @@ function render() {
|
|||
renderBeginningText();
|
||||
ctx.globalAlpha = 1;
|
||||
}
|
||||
|
||||
if (gameState == -1) {
|
||||
ctx.globalAlpha = 0.9;
|
||||
ctx.fillStyle = 'rgb(236,240,241)';
|
||||
ctx.fillRect(0, 0, trueCanvas.width, trueCanvas.height);
|
||||
ctx.globalAlpha = 1;
|
||||
}
|
||||
|
||||
settings.prevScale = settings.scale;
|
||||
settings.hexWidth = settings.baseHexWidth * settings.scale;
|
||||
settings.blockHeight = settings.baseBlockHeight * settings.scale;
|
||||
}
|
||||
|
||||
function renderBeginningText() {
|
||||
|
|
Loading…
Reference in a new issue