Merge branch 'main' of https://git.etud.insa-toulouse.fr/bocquel/Projet_JS
ajout cookie et popup cookie
This commit is contained in:
commit
d322df708e
6 changed files with 156 additions and 17 deletions
2
TODO.txt
2
TODO.txt
|
@ -1,2 +1,2 @@
|
||||||
younes: pop up cookie animation pop up
|
younes: pop up cookie animation pop up
|
||||||
|
raph : finir de faire marcher la grille, lier la grille à l'affichage des mines, faire la logique du jeu
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
<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">
|
<link rel="stylesheet" href="style.css">
|
||||||
<script src="demineur.js" defer></script>
|
|
||||||
|
<script type="text/javascript" src="demineur.js" defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body id="body_demineur">
|
<body id="body_demineur">
|
||||||
|
|
||||||
|
@ -27,9 +29,14 @@
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div id="jeu">ICI se retourve le jeu</div>
|
|
||||||
|
<div id="jeu">
|
||||||
<button id="debut_game" onclick="chrono()">GO!</button>
|
<button id="debut_game" onclick="chrono()">GO!</button>
|
||||||
<button id="fin_game" onclick="reset()">CIAO</button>
|
<button id="fin_game" onclick="reset()">CIAO</button>
|
||||||
|
<div id="grille">
|
||||||
|
<script type="text/javascript">grilleButtons(7,7);</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="popup" class="popup">
|
<div id="popup" class="popup">
|
||||||
|
|
41
demineur.js
41
demineur.js
|
@ -7,9 +7,6 @@ class Case {
|
||||||
this.hidden = true;
|
this.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
get imageName() {
|
|
||||||
return this.getImageName();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//Fonction pour créer un cookie.
|
//Fonction pour créer un cookie.
|
||||||
|
@ -56,18 +53,17 @@ function Cookies() {
|
||||||
//Cookies();
|
//Cookies();
|
||||||
|
|
||||||
|
|
||||||
|
let grille = [];
|
||||||
|
let hauteur = 7;
|
||||||
|
let largeur = 7;
|
||||||
|
|
||||||
function creerGrille(haut, larg) {
|
function creerGrille(haut, larg) {
|
||||||
grille.length = haut;
|
grille.length = haut;
|
||||||
let i = 0;
|
for (var i=0;i<haut;i++) {
|
||||||
let j = 0;
|
|
||||||
while (i < haut) {
|
|
||||||
grille[i] = Array(larg);
|
grille[i] = Array(larg);
|
||||||
j = 0;
|
for (var j=0;j<larg;j++){
|
||||||
while (j<larg) {
|
|
||||||
grille[i][j] = new Case(j, i);
|
grille[i][j] = new Case(j, i);
|
||||||
j = j + 1 ;
|
|
||||||
}
|
}
|
||||||
i = i + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,3 +91,28 @@ const cookieAccepted = getCookie('cookiesAccepted');
|
||||||
if (!cookieAccepted){
|
if (!cookieAccepted){
|
||||||
cookie();
|
cookie();
|
||||||
}
|
}
|
||||||
|
function changeImage(mouseEvent) {
|
||||||
|
mouseEvent.target.style.background="url('case_mine.png')" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function grilleButtons(haut, larg) {
|
||||||
|
const divGrille = document.getElementById("grille") ;
|
||||||
|
for (var i=0;i<haut;i++) {
|
||||||
|
for (var j=0;j<larg;j++){
|
||||||
|
|
||||||
|
var newCase = document.createElement("BUTTON") ;
|
||||||
|
newCase.style.gridrow=i.toString() ;
|
||||||
|
newCase.classList.add("button_case") ;
|
||||||
|
newCase.id = i.toString() + "_" + j.toString() ;
|
||||||
|
newCase.style.background="url('case_vide.png')" ;
|
||||||
|
newCase.addEventListener("click", changeImage);
|
||||||
|
divGrille.appendChild(newCase) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
69
main.css
Normal file
69
main.css
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: linear-gradient(135deg, #007BFF, #00C6FF);
|
||||||
|
color: #007BFF;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
max-width: 600px;
|
||||||
|
padding: 20px;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
header .logo {
|
||||||
|
width: 100px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
header h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
color: #007BFF;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.welcome-image {
|
||||||
|
width: 80%;
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 20px auto;
|
||||||
|
display: block;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 15px 30px;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #007BFF;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s, transform 0.2s;
|
||||||
|
}
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin-top: 20px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #888;
|
||||||
|
}
|
32
main.html
32
main.html
|
@ -1 +1,31 @@
|
||||||
<html></html>
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
|
||||||
|
<title>Démineur - Accueil</title>
|
||||||
|
<link rel="stylesheet" href="main.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header>
|
||||||
|
<img src="logo.png" alt="Logo du Démineur" class="logo">
|
||||||
|
<h1>Bienvenue dans le Monde du Démineur !</h1>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<p>Préparez-vous à une expérience de jeu inoubliable ! Cliquez sur le bouton ci-dessous pour commencer votre aventure.</p>
|
||||||
|
<img src="welcome-image.png" alt="Image de bienvenue" class="welcome-image">
|
||||||
|
<button id="play-button">JOUER</button>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<p>© 2024 Démineur. Tous droits réservés.</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('play-button').addEventListener('click', () => {
|
||||||
|
window.location.href = 'game.html';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
14
style.css
14
style.css
|
@ -27,12 +27,18 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#grille{
|
||||||
|
display : grid;
|
||||||
|
grid-template-columns : 50px 50px 50px 50px 50px 50px 50px;
|
||||||
|
grid-template-rows : 50px 50px 50px 50px 50px 50px 50px;
|
||||||
|
}
|
||||||
|
|
||||||
.item_nav{
|
.item_nav{
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
.popup {
|
.popup {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -83,4 +89,10 @@
|
||||||
|
|
||||||
#close-popup:hover {
|
#close-popup:hover {
|
||||||
background-color: #0056b3;
|
background-color: #0056b3;
|
||||||
|
=======
|
||||||
|
.button_case{
|
||||||
|
width : 50px;
|
||||||
|
height : 50px;
|
||||||
|
border : 0px;
|
||||||
|
>>>>>>> 2a2cf84cf311b49f5c290c8502b43f35efa7ec30
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue