Skip to content

Commit

Permalink
bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Vital-Vuillaume committed Jul 8, 2024
1 parent 7133f4a commit 5ad54b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 11 additions & 9 deletions Site/Js/JsGame/heart.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ let heart = heartMax;

let invincible = false

function invincibleMan(timeInvincible) {
invincible = true;
setTimeout(function() {
invincible = false;
}, timeInvincible);
}

function heartChange(heartLess) {

if (invincible) {
Expand All @@ -35,12 +42,10 @@ function heartChange(heartLess) {
soundDamage.play();
}

if(heart ==! 0) {
invincible = true;
setTimeout(function() {
invincible = false;
}, 2500);
if(heart > 0) {
invincibleMan(2500);
}

} else {
heart += heartLess;

Expand Down Expand Up @@ -76,10 +81,7 @@ reprendreDied.onclick = function() {
body.style.cursor = "none";
menuKeys = false;

invincible = true;
setTimeout(function() {
invincible = false;
}, 2500);
invincibleMan(2500);

if(!diedReprendre) {
heart = heartMax;
Expand Down
3 changes: 1 addition & 2 deletions Site/Js/JsGame/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,10 @@ window.addEventListener("keydown", function(e) {
if(!menuKeys){
if(PotionSpeed > 0 && playerSpeed === 2) {
playerSpeed = 3;
invincible = true;
setTimeout(function() {
playerSpeed = 2;
invincible = false;
}, 10000);
invincibleMan(10000);
potionSpeedChange(-1);
}
}
Expand Down

0 comments on commit 5ad54b6

Please sign in to comment.