|
|
@ -4,7 +4,7 @@ function initTimer() {
|
|
|
|
|
|
|
|
|
|
|
|
function move() {
|
|
|
|
function move() {
|
|
|
|
document.querySelector(".timer_txt").innerHTML = timeEnd - timer.getTimeValues().seconds;
|
|
|
|
document.querySelector(".timer_txt").innerHTML = timeEnd - timer.getTimeValues().seconds;
|
|
|
|
switch(timeEnd - timer.getTimeValues().seconds){
|
|
|
|
switch (timeEnd - timer.getTimeValues().seconds) {
|
|
|
|
case 5:
|
|
|
|
case 5:
|
|
|
|
case 4:
|
|
|
|
case 4:
|
|
|
|
document.querySelector(".timer_txt").style.color = "#eca1a6";
|
|
|
|
document.querySelector(".timer_txt").style.color = "#eca1a6";
|
|
|
@ -16,10 +16,16 @@ function move() {
|
|
|
|
document.querySelector(".timer_txt").style.color = "#c94c4c";
|
|
|
|
document.querySelector(".timer_txt").style.color = "#c94c4c";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
document.querySelector(".timer_txt").style.color = document.querySelector("#modeDeJeu").style.color;
|
|
|
|
document.querySelector(".timer_txt").style.color = document.querySelector("#modeDeJeu").style.color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function demarrerTimer() {
|
|
|
|
|
|
|
|
timer.start();
|
|
|
|
|
|
|
|
document.querySelector(".progress_bar").style.animationDuration = timeEnd + "s";
|
|
|
|
|
|
|
|
document.querySelector(".progress_bar").style.animationPlayState = 'running';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var timer = new easytimer.Timer();
|
|
|
|
var timer = new easytimer.Timer();
|
|
|
|
timer.start();
|
|
|
|
timer.start();
|
|
|
|
timer.addEventListener('secondsUpdated', function (e) {
|
|
|
|
timer.addEventListener('secondsUpdated', function (e) {
|
|
|
@ -32,44 +38,44 @@ timer.addEventListener('secondsUpdated', function (e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
function endTime() {
|
|
|
|
function endTime() {
|
|
|
|
if(!isTuto){
|
|
|
|
if (!isTuto) {
|
|
|
|
closeGame();
|
|
|
|
closeGame();
|
|
|
|
var score = (niveauActuel * (50 / timeTot)).toFixed(2);
|
|
|
|
var score = (niveauActuel * (50 / timeTot)).toFixed(2);
|
|
|
|
document.querySelector("#scoreTotGameOver").innerHTML = score;
|
|
|
|
document.querySelector("#scoreTotGameOver").innerHTML = score;
|
|
|
|
document.querySelector("#niveauGameOver").innerHTML = niveauActuel;
|
|
|
|
document.querySelector("#niveauGameOver").innerHTML = niveauActuel;
|
|
|
|
document.querySelector("#TempsTotGameOver").innerHTML = timeTot;
|
|
|
|
document.querySelector("#TempsTotGameOver").innerHTML = timeTot;
|
|
|
|
//calcul stars
|
|
|
|
//calcul stars
|
|
|
|
resetStar();
|
|
|
|
resetStar();
|
|
|
|
if(score < 10){
|
|
|
|
if (score < 10) {
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
}else if(score > 10 || score < 50){
|
|
|
|
} else if (score > 10 || score < 50) {
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
}else if(score > 50 || score < 200){
|
|
|
|
} else if (score > 50 || score < 200) {
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star3").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star3").style.color = "#fe8a71";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(score > 200 || score < 400){
|
|
|
|
else if (score > 200 || score < 400) {
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star3").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star3").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star4").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star4").style.color = "#fe8a71";
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star1").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star2").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star3").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star3").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star4").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star4").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star5").style.color = "#fe8a71";
|
|
|
|
document.querySelector("#star5").style.color = "#fe8a71";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
openModal('gameOver');
|
|
|
|
openModal('gameOver');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function resetStar(){
|
|
|
|
function resetStar() {
|
|
|
|
document.querySelector("#star1").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star1").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star2").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star2").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star3").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star3").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star4").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star4").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star5").style.color = document.body.style.color;
|
|
|
|
document.querySelector("#star5").style.color = document.body.style.color;
|
|
|
|
}
|
|
|
|
}
|