fixed merge commits
This commit is contained in:
commit
70b8d24c19
4 changed files with 16 additions and 17 deletions
|
@ -51,7 +51,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
//slate for final deletion
|
||||
this.opacity = 0;
|
||||
this.deleted = 2;
|
||||
if (gameState == 1) {
|
||||
if (gameState == 1 || gameState==0) {
|
||||
localStorage.setItem("saveState", exportSaveState());
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
|
||||
if (this.tint) {
|
||||
if (this.opacity < 1) {
|
||||
if (gameState == 1) {
|
||||
if (gameState == 1 || gameState==0) {
|
||||
localStorage.setItem("saveState", exportSaveState());
|
||||
}
|
||||
|
||||
|
|
|
@ -177,12 +177,11 @@ function initialize(a) {
|
|||
$(window).resize(scaleCanvas);
|
||||
$(window).unload(function(){
|
||||
|
||||
if(gameState ==1 || gameState ==-1) localStorage.setItem("saveState", exportSaveState());
|
||||
if (gameState == 1 || gameState == -1 || gameState === 0) localStorage.setItem("saveState", exportSaveState());
|
||||
else localStorage.clear();
|
||||
});
|
||||
|
||||
addKeyListeners();
|
||||
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-51272720-1', 'teamsnowman.github.io');
|
||||
ga('send', 'pageview');
|
||||
|
|
14
js/main.js
14
js/main.js
|
@ -274,14 +274,11 @@ function enableRestart() {
|
|||
}
|
||||
|
||||
function updateHighScore(){
|
||||
if(localStorage.getItem('highscores')){
|
||||
highscores = localStorage.getItem('highscores').split(',').map(Number);
|
||||
}
|
||||
|
||||
for (var i = 0; i < numHighScores; i++) {
|
||||
if (highscores[i] <= score) {
|
||||
highscores.splice(i, 0, score);
|
||||
highscores = highscores.slice(0,-1);
|
||||
//debugger;
|
||||
for(var i = 0; i<numHighScores;i++) {
|
||||
if(highscores[i]<=score) {
|
||||
highscores.splice(i,0,score);
|
||||
highscores = highscores.slice(0,3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -305,7 +302,6 @@ function isInfringing(hex){
|
|||
function checkGameOver() {
|
||||
for (var i = 0; i < MainHex.sides; i++) {
|
||||
if (isInfringing(MainHex)) {
|
||||
updateHighScore();
|
||||
gameOverDisplay();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ function drawScoreboard() {
|
|||
if (gameState === 0) {
|
||||
renderText(trueCanvas.width/2+ gdx + 6 * settings.scale, trueCanvas.height/2+ gdy, 60, "rgb(236, 240, 241)", String.fromCharCode("0xf04b"), 'px FontAwesome');
|
||||
renderText(trueCanvas.width/2+ gdx + 6 * settings.scale, trueCanvas.height/2+ gdy - 170 * settings.scale, 150, "#2c3e50", "Hextris");
|
||||
renderText(trueCanvas.width/2+ gdx + 6 * settings.scale, trueCanvas.height/2+ gdy + 170 * settings.scale, 20, "#2c3e50", "built by @teamsnowman");
|
||||
renderText(trueCanvas.width/2+ gdx + 6 * settings.scale, trueCanvas.height/2+ gdy + 200 * settings.scale, 20, "#2c3e50", "continued by @garrettdreyfus and @meadowstream on github");
|
||||
renderText(trueCanvas.width/2+ gdx + 5 * settings.scale, trueCanvas.height/2+ gdy + 100 * settings.scale, 20, "rgb(44,62,80)", 'Play!');
|
||||
}
|
||||
else if(gameState!=0 && textOpacity>0){
|
||||
|
@ -103,9 +105,10 @@ function showText(text){
|
|||
if (text == 'gameover') {
|
||||
var allZ = 1;
|
||||
var i;
|
||||
console.log(highscores);
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (highscores[i] !== undefined && highscores[i] != 0) {
|
||||
messages['gameover'] += "<tr> <th class='tg-031e'>1.</th> <th class='tg-031e'>"+highscores[i] + " pts</th> </tr>";
|
||||
messages['gameover'] += "<tr> <th class='tg-031e'>"+(i+1)+".</th> <th class='tg-031e'>"+highscores[i] + " pts</th> </tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,6 +204,7 @@ function hideText(text){
|
|||
pt.innerHTML = '';
|
||||
}
|
||||
function gameOverDisplay(){
|
||||
updateHighScore();
|
||||
var c = document.getElementById("canvas");
|
||||
c.className = "blur";
|
||||
showText('gameover');
|
||||
|
|
Loading…
Reference in a new issue