ajout du mode "jouer en x minutes"

inclusion-bdd
adplantade 5 years ago
parent b0fdee0319
commit c0d2eea638

@ -24,6 +24,7 @@ function chrono(){
msec = "0" +msec
}
document.getElementById("chronotime").innerHTML = hr + ":" + min + ":" + sec
timerID = setTimeout("chrono()", 10)
}
function chronoStart(){

@ -11,6 +11,7 @@
<ul class="stats">
<p id="temps"></p>
<span id="chronotime" class="stats">0:00:00</span>
<span id="timer" class="stats">0:00:00</span>
<p id="stats" class="stats"></p>
</ul>
@ -43,6 +44,7 @@
</ul>
<script src="selecteur.js"></script>
<script src="chrono.js"></script>
<script src="timer.js"></script>
<script src="vitraux.js"></script>
</body>

@ -6,15 +6,22 @@
<form action="./game.html" method="GET">
<input type="radio" id="no-res" name="diff" value="no-res">
<label for="no-res">Sans r&eacute;serve</label><br>
<input type="radio" id="5pts" name="mode" value="5">
Jouer la partie en : </br>
<input type="radio" id="5pts" name="mode" value="5p">
<label for="5pts">5 points</label><br>
<input type="radio" id="10pts" name="mode" value="10">
<input type="radio" id="10pts" name="mode" value="10p">
<label for="5pts">10 points</label><br>
<input type="radio" id="15pts" name="mode" value="15">
<input type="radio" id="15pts" name="mode" value="15p">
<label for="5pts">15 points</label><br>
<input type="radio" id="20pts" name="mode" value="20">
<input type="radio" id="20pts" name="mode" value="20p">
<label for="5pts">20 points</label><br>
<input type="radio" id="5min" name="mode" value="5m">
<label for="5pts">5 minutes</label><br>
<input type="radio" id="10min" name="mode" value="10m">
<label for="5pts">10 minutes</label><br>
<input type="radio" id="survie" name="mode" value="surv">
<label for="5pts">survie</label><br>
<div class="button">

@ -20,4 +20,13 @@ if(get['diff']=="no-res")
document.getElementById("canvasR").style.display="none";
document.getElementById("reserveText").style.display="none";
}
objPts=get['mode'];
if (get['mode'].includes('p'))
{
objPts=get['mode'].substring(0,get['mode'].length-1);
document.getElementById("timer").style.display="none";
}
else if(get['mode'].includes('m'))
{
tpsRem=[0,parseInt(get['mode'].substring(0,get['mode'].length-1),10),0];
document.getElementById("chronotime").style.display="none";
}

@ -0,0 +1,27 @@
var fin = new Date();
fin.setMinutes(fin.getMinutes()+tpsRem[1]);
document.getElementById("timer").innerHTML = tpsRem[0] + ":" + tpsRem[1] + ":" + tpsRem[2];
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();;
// Find the distance between now and the count down date
var distance = fin - now;
// Time calculations for days, hours, minutes and seconds
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
document.getElementById("timer").innerHTML = hours + ":" + minutes + ":" + seconds;
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
window.location.replace("./score.html?pts="+points);
}
}, 1000);
Loading…
Cancel
Save