The problem is that the character doesn't move if the collision is detected; instead, its position should be adjusted just enough to not make it clip into the tiles.