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,8 +60,9 @@ 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);
} }

View File

@@ -60,8 +60,9 @@ 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);
} }

View File

@@ -58,8 +58,9 @@ 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);
} }

View File

@@ -65,8 +65,9 @@ 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);
} }

View File

@@ -60,8 +60,9 @@ 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);
} }