🐛 Fix particles being moved twice

main
Shad Amethyst 2 years ago
parent c8c4ba5894
commit 01e7f456a7

@ -69,7 +69,7 @@ export function update(
}
if (
hasMoved(target.get(x, y + 1)) || hasMoved(target.get(x, y + 2))
hasMoved(target.get(x, y + 1)) // || hasMoved(target.get(x, y + 2))
) {
const left = isEmpty(target.get(x - 1, y + 1));
const right = isEmpty(target.get(x + 1, y + 1));
@ -90,10 +90,10 @@ export function update(
if (isSand(target.get(x, y - 1))) {
swap(target, x, y, x, y - 1);
swapped.push([x, y - 1]);
} else if (isSand(target.get(x - 1, y - 1))) {
} else if (isSand(target.get(x - 1, y - 1)) && !hasMoved(target.get(x - 1, y - 1))) {
swap(target, x, y, x - 1, y - 1);
swapped.push([x - 1, y - 1]);
} else if (isSand(target.get(x + 1, y - 1))) {
} else if (isSand(target.get(x + 1, y - 1)) && !hasMoved(target.get(x + 1, y - 1))) {
swap(target, x, y, x + 1, y - 1);
swapped.push([x + 1, y - 1]);
}

Loading…
Cancel
Save