Merge branch 'main' of https://git.etud.insa-toulouse.fr/bocquel/Projet_JS
rien
This commit is contained in:
commit
7017e3e673
9 changed files with 126 additions and 5 deletions
1
TODO.txt
Normal file
1
TODO.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
younes: final chrono , pop up cookie , centrer ligne , animation pop up
|
BIN
case_deux.png
Normal file
BIN
case_deux.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 389 B |
BIN
case_mine.png
Normal file
BIN
case_mine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 456 B |
BIN
case_trois.png
Normal file
BIN
case_trois.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 430 B |
BIN
case_un.png
Normal file
BIN
case_un.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 293 B |
BIN
case_vide.png
Normal file
BIN
case_vide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 228 B |
|
@ -4,15 +4,34 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Démineur</title>
|
<title>Démineur</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<script src="demineur.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body id="body_demineur">
|
||||||
<div id="div_nav_demineur">
|
|
||||||
<nav id="nav_demineur">
|
<nav id="nav_demineur">
|
||||||
|
<div class="item_nav">
|
||||||
<a href="main.html">Home</a>
|
<a href="main.html">Home</a>
|
||||||
|
</div>
|
||||||
|
<div class="item_nav">
|
||||||
<a href="https://demineur.nhtdev.com/fr/rules">Help</a>
|
<a href="https://demineur.nhtdev.com/fr/rules">Help</a>
|
||||||
Temps:
|
</div>
|
||||||
|
|
||||||
|
<div class="item_nav">
|
||||||
|
Temps:
|
||||||
|
<input id="temps" type="number" value="000" disabled>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item_nav">
|
||||||
Mines restantes:10
|
Mines restantes:10
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
|
||||||
|
<div id="jeu">ICI se retourve le jeu</div>
|
||||||
|
<button id="debut_game" onclick="chrono()">GO!</button>
|
||||||
|
<button id="fin_game" onclick="reset()">CIAO</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
65
demineur.js
65
demineur.js
|
@ -0,0 +1,65 @@
|
||||||
|
class Case {
|
||||||
|
constructor(x, y) {
|
||||||
|
this.posX = x;
|
||||||
|
this.posy = y;
|
||||||
|
this.isMine = false;
|
||||||
|
this.number = 0;
|
||||||
|
this.hidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
get imageName() {
|
||||||
|
return this.getImageName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function sleep(ms){
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
async function chrono(){
|
||||||
|
let k=document.getElementById("temps").value;
|
||||||
|
const myButton = document.getElementById("fin_game");
|
||||||
|
let arret=0;
|
||||||
|
myButton.addEventListener("click",() =>{arret=1;})
|
||||||
|
|
||||||
|
while(arret==!1) {
|
||||||
|
await sleep(1000);
|
||||||
|
if (arret==!1){
|
||||||
|
document.getElementById("temps").value=document.getElementById("temps").value*1+1;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function reset(){
|
||||||
|
|
||||||
|
document.getElementById("temps").value=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function Cookies() {
|
||||||
|
var accept = confirm("Tu veux des cookies ?");
|
||||||
|
if (accept === true) {
|
||||||
|
alert("Bon jeu!");
|
||||||
|
} else {
|
||||||
|
Cookies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Cookies();
|
||||||
|
|
||||||
|
let grille = [];
|
||||||
|
|
||||||
|
function creerGrille(haut, larg) {
|
||||||
|
grille.length = haut;
|
||||||
|
let i = 0;
|
||||||
|
let j = 0;
|
||||||
|
while (i < haut) {
|
||||||
|
grille[i] = Array(larg);
|
||||||
|
j = 0;
|
||||||
|
while (j<larg) {
|
||||||
|
grille[i][j] = new Case(j, i);
|
||||||
|
j = j + 1 ;
|
||||||
|
}
|
||||||
|
i = i + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
36
style.css
36
style.css
|
@ -0,0 +1,36 @@
|
||||||
|
#nav_demineur{
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
background-color: #2bd7d484;
|
||||||
|
border-width: 2px;
|
||||||
|
border-style: double;
|
||||||
|
height: 25px;
|
||||||
|
display: flex;
|
||||||
|
justify-content:flex-start;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#body_demineur{
|
||||||
|
background-color: rgba(128, 128, 128, 0.544);
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#jeu{
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: left;
|
||||||
|
border-width: 2px;
|
||||||
|
border-style: double;
|
||||||
|
width: 49%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.item_nav{
|
||||||
|
margin-top: 3px;
|
||||||
|
padding-right: 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue