From 41bf2d82de56bb29f55674cec56208f913e56181 Mon Sep 17 00:00:00 2001 From: Lily-129 <68935009+Lily-129@users.noreply.github.com> Date: Thu, 20 Jan 2022 21:06:50 -0500 Subject: [PATCH] Uploaded wavy sine draw function redefinition thing I didn't expect this to be possible. --- mods/acidboxels.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 mods/acidboxels.js diff --git a/mods/acidboxels.js b/mods/acidboxels.js new file mode 100644 index 00000000..c2a7622e --- /dev/null +++ b/mods/acidboxels.js @@ -0,0 +1,31 @@ +runAfterLoad(function() { + drawPixels = function(forceTick=false) { + // newCurrentPixels = shuffled currentPixels + var newCurrentPixels = currentPixels.slice(); + newCurrentPixels.sort(function() {return 0.5 - Math.random()}); + for (var i = 0; i < newCurrentPixels.length; i++) { + pixel = newCurrentPixels[i]; + //if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue} + if (pixel.del) {continue} + if ((!paused) || forceTick) {pixelTick(pixel);}; + } + // Draw the current pixels + if (!hiding) { + var canvas = document.getElementById("game"); + var ctx = canvas.getContext("2d"); + for (var i = 0; i < newCurrentPixels.length; i++) { + pixel = newCurrentPixels[i]; + if (pixelMap[pixel.x][pixel.y] == undefined) {continue} + ctx.fillStyle = pixel.color; + ctx.fillRect(pixel.x*pixelSize+(18*Math.sin((pixel.y)/4.4)), pixel.y*pixelSize+(18*Math.sin((pixel.x)/4.4)), pixelSize, pixelSize); + if (pixel.charge) { // Yellow glow on charge + if (!elements[pixel.element].colorOn) { + ctx.fillStyle = "rgba(255,255,0,0.5)"; + ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize); + } + } + } + } + if ((!paused) || forceTick) {pixelTicks++}; + } +});