mirror of
https://github.com/microsoft/Web-Dev-For-Beginners.git
synced 2025-08-13 10:14:50 +02:00
Fix laser cooldown bug
This commit is contained in:
@@ -60,9 +60,10 @@ class Hero extends GameObject {
|
||||
let id = setInterval(() => {
|
||||
if (this.cooldown > 0) {
|
||||
this.cooldown -= 100;
|
||||
} else {
|
||||
if(this.cooldown === 0) {
|
||||
clearInterval(id);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
canFire() {
|
||||
|
@@ -60,9 +60,10 @@ class Hero extends GameObject {
|
||||
let id = setInterval(() => {
|
||||
if (this.cooldown > 0) {
|
||||
this.cooldown -= 100;
|
||||
} else {
|
||||
if(this.cooldown === 0) {
|
||||
clearInterval(id);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
canFire() {
|
||||
|
@@ -58,9 +58,10 @@ class Hero extends GameObject {
|
||||
let id = setInterval(() => {
|
||||
if (this.cooldown > 0) {
|
||||
this.cooldown -= 100;
|
||||
} else {
|
||||
if(this.cooldown === 0) {
|
||||
clearInterval(id);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
canFire() {
|
||||
|
@@ -65,9 +65,10 @@ class Hero extends GameObject {
|
||||
let id = setInterval(() => {
|
||||
if (this.cooldown > 0) {
|
||||
this.cooldown -= 100;
|
||||
} else {
|
||||
if(this.cooldown === 0) {
|
||||
clearInterval(id);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
canFire() {
|
||||
|
@@ -60,9 +60,10 @@ class Hero extends GameObject {
|
||||
let id = setInterval(() => {
|
||||
if (this.cooldown > 0) {
|
||||
this.cooldown -= 100;
|
||||
} else {
|
||||
if(this.cooldown === 0) {
|
||||
clearInterval(id);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
canFire() {
|
||||
|
Reference in New Issue
Block a user