This bit of depth sorting code:
if ((objB.x < rightA) &&
(objB.y < frontA) &&
(objB.z < topA) &&
(i !== j)) {
behind.push(objB);
output = true;
}
isn't sufficient on it's own because it only places an IsoSprite infront of
another IsoSprite if it's to the right and below the one it's testing it
against.
The issue is that an IsoSprite can be on the same y but to the right, in this
case it should be placed infront of that IsoSprite. Same is true if it's on the
same x and tested IsoSprite is below the other.
The Solution is to replace that if statement with this:
if (i !== j) {
if ((objB.x < rightA) && (objB.y < frontA) && (objB.z < topA)) {
behind.push(objB);
}
else if (objA.y == objB.y && objB.x < rightA) {
behind.push(objB);
}
else if (objA.x == objB.x && objB.y < frontA) {
behind.push(objB);
}
}
Original issue reported on code.google.com by bedroom...@gmail.com on 25 May 2011 at 4:50
Original issue reported on code.google.com by
bedroom...@gmail.com
on 25 May 2011 at 4:50