From b0fdee03191d0eb8bd8c118e80c74ca96f15b798 Mon Sep 17 00:00:00 2001 From: adplantade Date: Thu, 2 Jul 2020 17:05:56 +0200 Subject: [PATCH] modes de jeux par points + page de score --- code/chrono.js | 14 +++++++++----- code/game.html | 18 ++++++++---------- code/index.html | 13 ++++++++++++- code/score.html | 13 +++++++++++++ code/selecteur.js | 6 ++++-- code/vitraux.js | 19 +++++++++++++++---- 6 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 code/score.html diff --git a/code/chrono.js b/code/chrono.js index 1ae0842..b8f025b 100644 --- a/code/chrono.js +++ b/code/chrono.js @@ -23,13 +23,15 @@ function chrono(){ else if(msec < 100){ msec = "0" +msec } - document.getElementById("chronotime").innerHTML = hr + ":" + min + ":" + sec + ":" + msec + document.getElementById("chronotime").innerHTML = hr + ":" + min + ":" + sec timerID = setTimeout("chrono()", 10) } function chronoStart(){ + /* document.chronoForm.startstop.value = "stop!" document.chronoForm.startstop.onclick = chronoStop - document.chronoForm.reset.onclick = chronoReset + document.chronoForm.reset.onclick = chronoReset + */ start = new Date() chrono() } @@ -42,16 +44,18 @@ function chronoContinue(){ chrono() } function chronoReset(){ - document.getElementById("chronotime").innerHTML = "0:00:00:000" + document.getElementById("chronotime").innerHTML = "0:00:00" start = new Date() } function chronoStopReset(){ - document.getElementById("chronotime").innerHTML = "0:00:00:000" + document.getElementById("chronotime").innerHTML = "0:00:00" document.chronoForm.startstop.onclick = chronoStart } function chronoStop(){ + /* document.chronoForm.startstop.value = "start!" document.chronoForm.startstop.onclick = chronoContinue - document.chronoForm.reset.onclick = chronoStopReset + document.chronoForm.reset.onclick = chronoStopReset + */ clearTimeout(timerID) } \ No newline at end of file diff --git a/code/game.html b/code/game.html index 4384e0c..487d0b8 100644 --- a/code/game.html +++ b/code/game.html @@ -10,19 +10,15 @@ - + - diff --git a/code/index.html b/code/index.html index 587b1b8..7b18736 100644 --- a/code/index.html +++ b/code/index.html @@ -4,8 +4,19 @@
- +
+ + +
+ +
+ +
+ +
+ +
diff --git a/code/score.html b/code/score.html new file mode 100644 index 0000000..a635eef --- /dev/null +++ b/code/score.html @@ -0,0 +1,13 @@ + + + + + + + + Votre score est :

+ + + diff --git a/code/selecteur.js b/code/selecteur.js index bfccbb9..d124d66 100644 --- a/code/selecteur.js +++ b/code/selecteur.js @@ -15,7 +15,9 @@ function $_GET(param) { var get=$_GET(); -if(get['mode']=="no-res") +if(get['diff']=="no-res") { document.getElementById("canvasR").style.display="none"; -} \ No newline at end of file + document.getElementById("reserveText").style.display="none"; +} +objPts=get['mode']; \ No newline at end of file diff --git a/code/vitraux.js b/code/vitraux.js index 4d9196b..33b2b78 100644 --- a/code/vitraux.js +++ b/code/vitraux.js @@ -402,12 +402,22 @@ var canvasT = document.getElementById('canvasTotal'); { var audio = new Audio('ress/Jewel4.mp3'); audio.play(); - points++; - document.getElementById("stats").innerHTML = points+" points"; - chronoStop(); + handleScore(1); generateEasy(); } } + + function handleScore(modif) + { + points+=modif; + document.getElementById("stats").innerHTML = points+" points"; + + if(points==objPts) + { + chronoStop(); + window.location.replace("./score.html?pts="+document.getElementById("chronotime").innerHTML); + } + } function changeOrder(from, to) { @@ -514,4 +524,5 @@ var canvasT = document.getElementById('canvasTotal'); events(); - generateEasy(); \ No newline at end of file + generateEasy(); + chronoStart(); \ No newline at end of file