diff --git a/src/collision/GridBroadphase.hx b/src/collision/GridBroadphase.hx index 4342b9f9..7c91b64a 100644 --- a/src/collision/GridBroadphase.hx +++ b/src/collision/GridBroadphase.hx @@ -246,7 +246,11 @@ class GridBroadphase { for (i in xStart...xEnd) { for (j in yStart...yEnd) { for (surfIdx in cells[16 * i + j]) { - var surf = objects[surfIdx].object; + // remove() nulls the slot but keeps the index; build() skips these too. + var proxy = objects[surfIdx]; + if (proxy == null) + continue; + var surf = proxy.object; if (surf.key == searchKey) continue; surf.key = searchKey; diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx index 17ced146..b57ffbed 100644 --- a/src/gui/PlayGui.hx +++ b/src/gui/PlayGui.hx @@ -1077,7 +1077,8 @@ class PlayGui { gemCountNumbers[4].anim.visible = false; gemCountNumbers[5].anim.visible = false; - var off = playerList[0].us ? 10 : 0; + // playerList is multiplayer-only, so it is empty in single player. + var off = (playerList.length > 0 && playerList[0].us) ? 10 : 0; gemCountNumbers[0].anim.currentFrame = off + collectedHundredths; gemCountNumbers[1].anim.currentFrame = off + collectedTenths;