Merge pull request #174 from TwentyPorts/main

Fix laser cooldown bug
This commit is contained in:
chris
2021-01-20 23:19:09 +00:00
committed by GitHub
5 changed files with 15 additions and 10 deletions

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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() {