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(() => {
|
let id = setInterval(() => {
|
||||||
if (this.cooldown > 0) {
|
if (this.cooldown > 0) {
|
||||||
this.cooldown -= 100;
|
this.cooldown -= 100;
|
||||||
} else {
|
if(this.cooldown === 0) {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
canFire() {
|
canFire() {
|
||||||
|
@@ -60,9 +60,10 @@ class Hero extends GameObject {
|
|||||||
let id = setInterval(() => {
|
let id = setInterval(() => {
|
||||||
if (this.cooldown > 0) {
|
if (this.cooldown > 0) {
|
||||||
this.cooldown -= 100;
|
this.cooldown -= 100;
|
||||||
} else {
|
if(this.cooldown === 0) {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
canFire() {
|
canFire() {
|
||||||
|
@@ -58,9 +58,10 @@ class Hero extends GameObject {
|
|||||||
let id = setInterval(() => {
|
let id = setInterval(() => {
|
||||||
if (this.cooldown > 0) {
|
if (this.cooldown > 0) {
|
||||||
this.cooldown -= 100;
|
this.cooldown -= 100;
|
||||||
} else {
|
if(this.cooldown === 0) {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
canFire() {
|
canFire() {
|
||||||
|
@@ -65,9 +65,10 @@ class Hero extends GameObject {
|
|||||||
let id = setInterval(() => {
|
let id = setInterval(() => {
|
||||||
if (this.cooldown > 0) {
|
if (this.cooldown > 0) {
|
||||||
this.cooldown -= 100;
|
this.cooldown -= 100;
|
||||||
} else {
|
if(this.cooldown === 0) {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
canFire() {
|
canFire() {
|
||||||
|
@@ -60,9 +60,10 @@ class Hero extends GameObject {
|
|||||||
let id = setInterval(() => {
|
let id = setInterval(() => {
|
||||||
if (this.cooldown > 0) {
|
if (this.cooldown > 0) {
|
||||||
this.cooldown -= 100;
|
this.cooldown -= 100;
|
||||||
} else {
|
if(this.cooldown === 0) {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
canFire() {
|
canFire() {
|
||||||
|
Reference in New Issue
Block a user