diff --git a/6-space-game/4-collision-detection/solution/app.js b/6-space-game/4-collision-detection/solution/app.js index 2fe85994..30030312 100644 --- a/6-space-game/4-collision-detection/solution/app.js +++ b/6-space-game/4-collision-detection/solution/app.js @@ -60,8 +60,9 @@ class Hero extends GameObject { let id = setInterval(() => { if (this.cooldown > 0) { this.cooldown -= 100; - } else { - clearInterval(id); + if(this.cooldown === 0) { + clearInterval(id); + } } }, 200); } diff --git a/6-space-game/5-keeping-score/solution/app.js b/6-space-game/5-keeping-score/solution/app.js index 87978a91..59eb7d6d 100644 --- a/6-space-game/5-keeping-score/solution/app.js +++ b/6-space-game/5-keeping-score/solution/app.js @@ -60,8 +60,9 @@ class Hero extends GameObject { let id = setInterval(() => { if (this.cooldown > 0) { this.cooldown -= 100; - } else { - clearInterval(id); + if(this.cooldown === 0) { + clearInterval(id); + } } }, 200); } diff --git a/6-space-game/5-keeping-score/your-work/app.js b/6-space-game/5-keeping-score/your-work/app.js index 8f01eef9..2bd9e5ac 100644 --- a/6-space-game/5-keeping-score/your-work/app.js +++ b/6-space-game/5-keeping-score/your-work/app.js @@ -58,8 +58,9 @@ class Hero extends GameObject { let id = setInterval(() => { if (this.cooldown > 0) { this.cooldown -= 100; - } else { - clearInterval(id); + if(this.cooldown === 0) { + clearInterval(id); + } } }, 200); } diff --git a/6-space-game/6-end-condition/solution/app.js b/6-space-game/6-end-condition/solution/app.js index f16f290c..9004f5ba 100644 --- a/6-space-game/6-end-condition/solution/app.js +++ b/6-space-game/6-end-condition/solution/app.js @@ -65,8 +65,9 @@ class Hero extends GameObject { let id = setInterval(() => { if (this.cooldown > 0) { this.cooldown -= 100; - } else { - clearInterval(id); + if(this.cooldown === 0) { + clearInterval(id); + } } }, 200); } diff --git a/6-space-game/6-end-condition/your-work/app.js b/6-space-game/6-end-condition/your-work/app.js index abad8476..e8023401 100644 --- a/6-space-game/6-end-condition/your-work/app.js +++ b/6-space-game/6-end-condition/your-work/app.js @@ -60,8 +60,9 @@ class Hero extends GameObject { let id = setInterval(() => { if (this.cooldown > 0) { this.cooldown -= 100; - } else { - clearInterval(id); + if(this.cooldown === 0) { + clearInterval(id); + } } }, 200); }