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