bruit de pas quand on s'avance dans le couloir

This commit is contained in:
Florian Ehr 2020-12-15 17:29:48 +01:00
parent 268f89b053
commit 0d0602b49e
5 changed files with 30 additions and 3 deletions

View file

@ -64,6 +64,7 @@ body {
padding: 1vw 1.2vw 1vw 1.2vw; padding: 1vw 1.2vw 1vw 1.2vw;
color: black; color: black;
font-family: 'Special Elite', cursive; font-family: 'Special Elite', cursive;
text-align: center;
font-size: 0.8vw; font-size: 0.8vw;
background-image: linear-gradient(to top, black -50%, #BF0909 80%); background-image: linear-gradient(to top, black -50%, #BF0909 80%);
cursor : pointer; cursor : pointer;

View file

@ -8,8 +8,9 @@
<link rel="stylesheet" href="../CSS/couloir.css"> <link rel="stylesheet" href="../CSS/couloir.css">
<link rel="preconnect" href="https://fonts.gstatic.com"> <link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Special+Elite&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Special+Elite&display=swap" rel="stylesheet">
<script defer type="text/javascript" src="../JAVASCRIPT/couloir.js"></script>
</head> </head>
<body> <body id="body">
<header> <header>
<h1>Sur les traces</h1> <h1>Sur les traces</h1>
<nav><a href='./menu.html'>Retourner au menu</a></nav> <nav><a href='./menu.html'>Retourner au menu</a></nav>
@ -24,8 +25,8 @@
</p> </p>
</article> </article>
<div id="buttons"> <div id="buttons">
<button id="safeButton" class="button" onclick="window.location.href = './aide_ami.html';">Prendre une photo, vous en parlerez à quelqu'un plus tard</button> <button id="button1" class="button" onclick="window.location.href = './aide_ami.html';">Prendre une photo, vous en parlerez à quelqu'un plus tard</button>
<button id="riskyButton" class="button" onclick="window.location.href = './crypto_seul.html';">Attendre qu'ils rentrent, prendre son courage à deux mains, et s'aventurer jusqu'à cette salle</button> <a id="button2" class="button">Attendre qu'ils rentrent, prendre son courage à deux mains, et s'aventurer jusqu'à cette salle</a>
</div> </div>
</section> </section>
</main> </main>

View file

@ -54,8 +54,11 @@ function handleButtonClicked(event) {
button.setAttribute('href', './couloir_ami.html'); button.setAttribute('href', './couloir_ami.html');
button.click(); button.click();
} else { } else {
//desactive le lien
button.removeAttribute('href'); button.removeAttribute('href');
//on enleve l'event listener pour pas pouvoir spam le bouton
button.removeEventListener("click", handleButtonClicked); button.removeEventListener("click", handleButtonClicked);
//faire clignoter le message d'erreur
let repeater = setInterval(() => { let repeater = setInterval(() => {
friendInput.setAttribute("placeholder", ""); friendInput.setAttribute("placeholder", "");
setTimeout(() => { setTimeout(() => {
@ -71,6 +74,7 @@ function handleButtonClicked(event) {
} }
//------------------ Gestion events ------------------// //------------------ Gestion events ------------------//
//Pour pas faire apparaitre le texte avant que la premiere phrase soit apparue
setTimeout(() => { setTimeout(() => {
document.addEventListener("keypress", makeNextTextAppear); document.addEventListener("keypress", makeNextTextAppear);
}, 2000); }, 2000);

21
JAVASCRIPT/couloir.js Normal file
View file

@ -0,0 +1,21 @@
// -------------- VARIABLES -------------//
let lienCrypto = document.getElementById("button2");
let body = document.getElementById("body");
// -------------- FUNCTIONS -------------//
function handleLienCryptoClicked() {
let audioPas = document.createElement("audio");
audioPas.setAttribute("preload", "auto");
audioPas.setAttribute("autoplay", true);
audioPas.setAttribute("src", "../Sounds/pas_insaide.mp3");
audioPas.style.cssText = "z-index: -1; opacity: 0;";
body.appendChild(audioPas);
setTimeout(() => {
lienCrypto.setAttribute("href", "./crypto_seul.html");
lienCrypto.click();
}, 5000);
}
// --------------- EVENTS ---------------//
lienCrypto.addEventListener("click", handleLienCryptoClicked);

BIN
Sounds/pas_insaide.mp3 Normal file

Binary file not shown.