diff --git a/Toy b/Toy index 1481216..2157b2f 160000 --- a/Toy +++ b/Toy @@ -1 +1 @@ -Subproject commit 1481216e69c4fe528f43f8171caf070d529b5e87 +Subproject commit 2157b2f5406f9d21e630e9696f34d06e31d85f99 diff --git a/assets/scripts/gameplay/scene.toy b/assets/scripts/gameplay/scene.toy index 58c3a3e..b96709c 100644 --- a/assets/scripts/gameplay/scene.toy +++ b/assets/scripts/gameplay/scene.toy @@ -130,14 +130,21 @@ fn depthComparator(lhs: opaque, rhs: opaque) { //for sorting by depth var lhsPos = lhs.callNodeFn("getRealPos"); var rhsPos = rhs.callNodeFn("getRealPos"); + var result = null; + if (lhsPos[1] == rhsPos[1]) { //BUGFIX: prevent z-fighting if (lhsPos[0] == rhsPos[0]) { - return true; + result = true; } - return lhsPos[0] < rhsPos[0]; + else { + result = lhsPos[0] < rhsPos[0]; + } + } + else { + result = lhsPos[1] < rhsPos[1]; } - return lhsPos[1] < rhsPos[1]; + return result; } fn getCameraPos(node: opaque) {