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:
Laetitia (O-01-67) 2023-03-08 17:03:42 -05:00 committed by GitHub
parent 833bf4cb34
commit c84eda85a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -32,15 +32,21 @@ function tryMove(pixel,nx,ny,leaveBehind=undefined) {
var info = elements[pixel.element];
var oob = outOfBounds(nx,ny);
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);
return true;
}
else if (!oob) {
//console.log(`Moving ${pixel.element} (${pixel.x},${pixel.y}) to (${nx},${ny})`);
// Reactions
newPixel = pixelMap[nx][ny];
var newInfo = elements[newPixel.element];
if(newInfo.onTryMoveInto !== undefined) {
newInfo.onTryMoveInto(newPixel,pixel);
if(!pixel || pixel.del) {
return "deleted";
};
return true;
}
var rr1 = false;
if (info.reactions !== undefined && info.reactions[newPixel.element] !== undefined) {