defense HUD

added defense bar to HUD
new community map commandeer by Desboot

bug fixes
This commit is contained in:
landgreen
2023-03-11 13:47:41 -08:00
parent 36541986ba
commit 9bcf4d3e8c
11 changed files with 1079 additions and 165 deletions

View File

@@ -323,7 +323,7 @@ const powerUps = {
document.getElementById("choose-grid").style.visibility = "visible"
requestAnimationFrame(() => {
ctx.fillStyle = `rgba(150,150,150,0.6)`; //`rgba(221,221,221,0.6)`;
ctx.fillStyle = `rgba(150,150,150,0.9)`; //`rgba(221,221,221,0.6)`;
ctx.fillRect(0, 0, canvas.width, canvas.height);
});
// document.getElementById("pause-grid-right").style.opacity = "0.7"
@@ -1084,23 +1084,39 @@ const powerUps = {
// }
if (tech.isBrainstorm && !tech.isBrainstormActive && !simulation.isChoosing) {
tech.isBrainstormActive = true
let count = 0
function cycle() {
count++
if (count < tech.brainStormDelay * 5 && simulation.isChoosing) {
if (!(count % tech.brainStormDelay)) {
powerUps.tech.effect();
document.getElementById("choose-grid").style.pointerEvents = "auto"; //turn off the normal 500ms delay
document.body.style.cursor = "auto";
document.getElementById("choose-grid").style.transitionDuration = "0s";
}
let count = 1
let timeStart = performance.now()
const cycle = (timestamp) => {
// if (timeStart === undefined) timeStart = timestamp
// console.log(timestamp, timeStart)
if (timestamp - timeStart > tech.brainStormDelay * count) {
count++
powerUps.tech.effect();
document.getElementById("choose-grid").style.pointerEvents = "auto"; //turn off the normal 500ms delay
document.body.style.cursor = "auto";
document.getElementById("choose-grid").style.transitionDuration = "0s";
}
if (count < 5 && simulation.isChoosing) {
requestAnimationFrame(cycle);
} else {
tech.isBrainstormActive = false
}
}
requestAnimationFrame(cycle);
// count++
// if (count < tech.brainStormDelay * 5 && simulation.isChoosing) {
// if (!(count % tech.brainStormDelay)) {
// powerUps.tech.effect();
// document.getElementById("choose-grid").style.pointerEvents = "auto"; //turn off the normal 500ms delay
// document.body.style.cursor = "auto";
// document.getElementById("choose-grid").style.transitionDuration = "0s";
// }
// requestAnimationFrame(cycle);
// } else {
// tech.isBrainstormActive = false
// }
}
// if (localSettings.isHideImages) text += powerUps.researchText('tech')
document.getElementById("choose-grid").innerHTML = text