TP01, TP02 & TP03EX01
This commit is contained in:
26
TP03/EX01/cookie.html
Normal file
26
TP03/EX01/cookie.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<title>Cookie clicker</title>
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Cookie clicker</h1>
|
||||
<figure>
|
||||
<img id="cookie"src="img/cookie.png" alt="cookie">
|
||||
<span id="score">0</span>
|
||||
</figure>
|
||||
|
||||
<button id="btnStart">start</button>
|
||||
|
||||
<p id="meme" class="hidden">
|
||||
<img src="img/memee.png" alt="memee" width="64" height="64">
|
||||
<span id="temps"></span>
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript" src="./js/game.js"></script>
|
||||
</body>
|
||||
</html>
|
BIN
TP03/EX01/css/img/bg.jpg
Normal file
BIN
TP03/EX01/css/img/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
63
TP03/EX01/css/style.css
Normal file
63
TP03/EX01/css/style.css
Normal file
@@ -0,0 +1,63 @@
|
||||
@import url(https://fonts.googleapis.com/css?family=Kavoon);
|
||||
|
||||
body {
|
||||
background-image: url("img/bg.jpg");
|
||||
background-repeat: repeat;
|
||||
font-family: Kavoon;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 320px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
background-color: rgba(0, 0, 0, 0.25);
|
||||
padding: 10px 40px 10px 40px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
figure {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
figure > span {
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 50px;
|
||||
border-radius: 21px;
|
||||
height: 42px;
|
||||
width: 56px;
|
||||
background-color: #f4d03f;
|
||||
box-shadow: 4px 4px 4px black;
|
||||
padding-top: 9px;
|
||||
}
|
||||
|
||||
button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
font-family: Kavoon;
|
||||
font-size: 24px;
|
||||
background-color: white;
|
||||
padding: 9px;
|
||||
border-radius: 10px;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
img[alt="GrandMa"] {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
BIN
TP03/EX01/img/bg.jpg
Normal file
BIN
TP03/EX01/img/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
BIN
TP03/EX01/img/cookie.png
Normal file
BIN
TP03/EX01/img/cookie.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 KiB |
BIN
TP03/EX01/img/memee.png
Normal file
BIN
TP03/EX01/img/memee.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
48
TP03/EX01/js/game.js
Normal file
48
TP03/EX01/js/game.js
Normal file
@@ -0,0 +1,48 @@
|
||||
var btnStart = document.getElementById("btnStart");
|
||||
var scoreView = document.getElementById("score");
|
||||
var tempsView = document.getElementById("temps");
|
||||
var meme = document.getElementById("meme");
|
||||
var cookie = document.getElementById("cookie");
|
||||
var score;
|
||||
var temps;
|
||||
var isPlayed=false;
|
||||
var texte = " seconds left!";
|
||||
var tailleCookieInitiale = cookie.naturalWidth;
|
||||
|
||||
btnStart.addEventListener('click', start);
|
||||
cookie.addEventListener('click', clicCookie);
|
||||
|
||||
tempsView.style.color = "red";
|
||||
|
||||
function start(event){
|
||||
if (!isPlayed){
|
||||
meme.style.display="block";
|
||||
cookie.style.width = tailleCookieInitiale+"px";
|
||||
temps = 15;
|
||||
score = 0;
|
||||
scoreView.textContent = score;
|
||||
isPlayed = true;
|
||||
tempsView.textContent = temps+texte;
|
||||
setTimeout(second,1000);
|
||||
}
|
||||
}
|
||||
|
||||
function clicCookie(event){
|
||||
if (isPlayed){
|
||||
score ++;
|
||||
cookie.style.width = (tailleCookieInitiale+score)+"px";
|
||||
scoreView.textContent = score;
|
||||
}
|
||||
}
|
||||
|
||||
function second(){
|
||||
temps --;
|
||||
tempsView.textContent = temps+texte;
|
||||
if (temps <= 0){
|
||||
isPlayed = false;
|
||||
meme.style.display="none";
|
||||
}
|
||||
else{
|
||||
setTimeout(second,1000);
|
||||
}
|
||||
}
|
11
TP03/EX02/css/style.css
Normal file
11
TP03/EX02/css/style.css
Normal file
@@ -0,0 +1,11 @@
|
||||
img{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
#gagne,#perdu,.hidden{
|
||||
display : none;
|
||||
}
|
||||
|
||||
.progress::-webkit-progress-value {
|
||||
transition: width 0.5s ease;
|
||||
}
|
BIN
TP03/EX02/images/off.png
Normal file
BIN
TP03/EX02/images/off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
BIN
TP03/EX02/images/on.png
Normal file
BIN
TP03/EX02/images/on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
1
TP03/EX02/js/memory.js
Normal file
1
TP03/EX02/js/memory.js
Normal file
@@ -0,0 +1 @@
|
||||
// TODO
|
64
TP03/EX02/memory.html
Normal file
64
TP03/EX02/memory.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="initial-scale=1,witdh=device-width">
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
<script src="./js/memory.js"></script>
|
||||
|
||||
<title>Memory</title>
|
||||
</head>
|
||||
|
||||
<body class="m-4">
|
||||
<main class="container">
|
||||
<h1 class="title is-1 has-text-primary">Memory</h1>
|
||||
<div class="columns">
|
||||
<div class="column is-6">
|
||||
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<img src="./images/off.png" alt="" />
|
||||
<img src="./images/off.png" alt="" />
|
||||
<img src="./images/off.png" alt="" />
|
||||
</div>
|
||||
<div class="column">
|
||||
<img src="./images/off.png" alt="" />
|
||||
<img src="./images/off.png" alt="" />
|
||||
<img src="./images/off.png" alt="" />
|
||||
</div>
|
||||
<div class="column">
|
||||
<img src="./images/off.png" alt="" />
|
||||
<img src="./images/off.png" alt="" />
|
||||
<img src="./images/off.png" alt="" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column is-6">
|
||||
<h3 class="title is-3 has-text-primary">Règles</h3>
|
||||
<p class="block is-size-4">
|
||||
Pendant une seconde, vous verrez l'état de l'ensemble
|
||||
des ampoules, puis elles seront éteintes. Vous devrez
|
||||
alors cliquer sur celles qui étaient allumées.
|
||||
</p>
|
||||
|
||||
<button class="block button is-info">COMMENCER</button>
|
||||
<progress id="temps" class="progress is-primary" value="100" max="100"></progress>
|
||||
|
||||
<!--div id="temps">10</div-->
|
||||
|
||||
<div class="notification is-danger is-size-4 p-4" id="perdu">
|
||||
<p>Perdu ! </p>
|
||||
</div>
|
||||
<div class="notification is-success is-size-4 p-4" id="gagne">
|
||||
<p>Gagné ! </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user