mirror of
https://github.com/microsoft/Web-Dev-For-Beginners.git
synced 2025-08-11 17:24:24 +02:00
Fix laser cooldown bug
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user