Update velocity.js
This commit is contained in:
parent
347250039b
commit
2dc6024169
|
|
@ -62,7 +62,6 @@ drawPixels = function(forceTick=false) {
|
||||||
//if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue}
|
//if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue}
|
||||||
if (pixel.del) {continue}
|
if (pixel.del) {continue}
|
||||||
if (!paused || forceTick) {
|
if (!paused || forceTick) {
|
||||||
// VELOCITY
|
|
||||||
doVelocity(pixel);
|
doVelocity(pixel);
|
||||||
if (elements[pixel.element].tick) { // Run tick function if it exists
|
if (elements[pixel.element].tick) { // Run tick function if it exists
|
||||||
elements[pixel.element].tick(pixel);
|
elements[pixel.element].tick(pixel);
|
||||||
|
|
@ -72,6 +71,7 @@ drawPixels = function(forceTick=false) {
|
||||||
pixelTick(pixel);
|
pixelTick(pixel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (pixel.con) { pixel = pixel.con }
|
||||||
if (elements[pixel.element].isGas || elements[pixel.element].glow) {
|
if (elements[pixel.element].isGas || elements[pixel.element].glow) {
|
||||||
pixelsLast.push(pixel);
|
pixelsLast.push(pixel);
|
||||||
}
|
}
|
||||||
|
|
@ -81,12 +81,18 @@ drawPixels = function(forceTick=false) {
|
||||||
}
|
}
|
||||||
// Draw the current pixels
|
// Draw the current pixels
|
||||||
var canvas = document.getElementById("game");
|
var canvas = document.getElementById("game");
|
||||||
if (canvas === null) {return}
|
|
||||||
var ctx = canvas.getContext("2d");
|
var ctx = canvas.getContext("2d");
|
||||||
|
// Clear the canvas
|
||||||
|
if (!settings["bg"]) {ctx.clearRect(0, 0, canvas.width, canvas.height)}
|
||||||
|
else {
|
||||||
|
ctx.fillStyle = settings["bg"];
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
}
|
||||||
var pixelDrawList = pixelsFirst.concat(pixelsLast);
|
var pixelDrawList = pixelsFirst.concat(pixelsLast);
|
||||||
for (var i = 0; i < pixelDrawList.length; i++) {
|
for (var i = 0; i < pixelDrawList.length; i++) {
|
||||||
pixel = pixelDrawList[i];
|
pixel = pixelDrawList[i];
|
||||||
if (pixelMap[pixel.x][pixel.y] == undefined) {continue}
|
if (pixelMap[pixel.x][pixel.y] == undefined) {continue}
|
||||||
|
if (pixel.con) { pixel = pixel.con }
|
||||||
if (view===null || view===3) {
|
if (view===null || view===3) {
|
||||||
ctx.fillStyle = pixel.color;
|
ctx.fillStyle = pixel.color;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue