fixed bug causing ghosting when the otherPixel was deleted
probably no docs ever, so have a Kiss Later instead https://drive.google.com/file/d/1w3SesQe6rxwfrBD5ZX2BuiQSfRoKCuUD/view?usp=share_link
This commit is contained in:
parent
833bf4cb34
commit
c84eda85a9
|
|
@ -32,15 +32,21 @@ function tryMove(pixel,nx,ny,leaveBehind=undefined) {
|
||||||
var info = elements[pixel.element];
|
var info = elements[pixel.element];
|
||||||
var oob = outOfBounds(nx,ny);
|
var oob = outOfBounds(nx,ny);
|
||||||
if (isEmpty(nx,ny,false,oob)) { // If coords is empty, move to coords
|
if (isEmpty(nx,ny,false,oob)) { // If coords is empty, move to coords
|
||||||
|
//console.log(`Moving ${pixel.element} (${pixel.x},${pixel.y}) to (${nx},${ny})`);
|
||||||
movePixel(pixel,nx,ny,leaveBehind);
|
movePixel(pixel,nx,ny,leaveBehind);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (!oob) {
|
else if (!oob) {
|
||||||
|
//console.log(`Moving ${pixel.element} (${pixel.x},${pixel.y}) to (${nx},${ny})`);
|
||||||
// Reactions
|
// Reactions
|
||||||
newPixel = pixelMap[nx][ny];
|
newPixel = pixelMap[nx][ny];
|
||||||
var newInfo = elements[newPixel.element];
|
var newInfo = elements[newPixel.element];
|
||||||
if(newInfo.onTryMoveInto !== undefined) {
|
if(newInfo.onTryMoveInto !== undefined) {
|
||||||
newInfo.onTryMoveInto(newPixel,pixel);
|
newInfo.onTryMoveInto(newPixel,pixel);
|
||||||
|
if(!pixel || pixel.del) {
|
||||||
|
return "deleted";
|
||||||
|
};
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
var rr1 = false;
|
var rr1 = false;
|
||||||
if (info.reactions !== undefined && info.reactions[newPixel.element] !== undefined) {
|
if (info.reactions !== undefined && info.reactions[newPixel.element] !== undefined) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue