gas charge fix

This commit is contained in:
Lily-129 2022-03-01 12:15:16 -05:00 committed by GitHub
parent bcbed3959c
commit 6d1b06f467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 8 deletions

View File

@ -98,13 +98,21 @@ function drawPixels(forceTick=false) {
ctx.arc((pixel.x+0.5)*pixelSize+(18*Math.sin((pixel.y+incrementt)/4.4)), (pixel.y+0.5)*pixelSize+(18*Math.sin((pixel.x+incrementt)/4.4)), pixelSize/2, 0, 2 * Math.PI, false); ctx.arc((pixel.x+0.5)*pixelSize+(18*Math.sin((pixel.y+incrementt)/4.4)), (pixel.y+0.5)*pixelSize+(18*Math.sin((pixel.x+incrementt)/4.4)), pixelSize/2, 0, 2 * Math.PI, false);
ctx.fill(); ctx.fill();
} }
if (pixel.charge && view !== 2) { // Yellow glow on charge if (pixel.charge && view !== 2) { // Yellow glow on charge
if (!elements[pixel.element].colorOn) { if (!elements[pixel.element].colorOn) {
ctx.fillStyle = "rgba(255,255,0,0.5)"; if ((view === null || view === 4) && elements[pixel.element].state === "gas") {
ctx.arc((pixel.x+0.5)*pixelSize+(18*Math.sin((pixel.y+incrementt)/4.4)), (pixel.y+0.5)*pixelSize+(18*Math.sin((pixel.x+incrementt)/4.4)), pixelSize/2, 0, 2 * Math.PI, false); ctx.fillStyle = "rgba(255,255,0,0.5)";
ctx.fill(); ctx.beginPath();
} ctx.arc((pixel.x+0.5)*pixelSize+(18*Math.sin((pixel.y+incrementt)/4.4)), (pixel.y+0.5)*pixelSize+(18*Math.sin((pixel.x+incrementt)/4.4)), pixelSize*1.5, 0, 2 * Math.PI, false);
} ctx.fill();
} else {
ctx.fillStyle = "rgba(255,255,0,0.5)";
ctx.beginPath();
ctx.arc((pixel.x+0.5)*pixelSize+(18*Math.sin((pixel.y+incrementt)/4.4)), (pixel.y+0.5)*pixelSize+(18*Math.sin((pixel.x+incrementt)/4.4)), pixelSize/2, 0, 2 * Math.PI, false);
ctx.fill();
}
}
}
} }
if ((!paused) || forceTick) {pixelTicks++}; if ((!paused) || forceTick) {pixelTicks++};
} }