On the original Switris source, the gravity/collapsing behavior is implemented in ‘removeCompletedLines()’ which is called (weirdly) from within GameViewController’s implementation of the ‘gameShapeDidLand()’. Let’s start by just reimplementing removeCompletedLines() without changing its interface.

As you can see, the original Gravity is a lot simpler and makes the game harder & more fun. Also, note that ‘removeFullLines()’ has unnecessary complexity on its return values (Array of Arrays instead of simple Arrays) – we’ll fix that later.
And there’s a little problem with simply replacing ‘removeCompletedLines()’ by ‘removeFullLines()’; removeFullLines returns all fallen blocks in the same/first subarray of fallenBlocks; where the original one would return on subarray for each column. This causes a problem since the blockIdx within each of the subarrays is used to time a animation on the GameScene side so everything will work fine but the game will lock for a few seconds every time you fill a line (linear to the full amount of blocks falling), I plan to provide a way better fix for this later but for now this solves the immediate problem: