It still glitches when walking diagonally.
Like this, I can loop over the column/row facing the collision side, ie for z = tile; z < tile + len.
I'm trying to get it working.