I've already thought about this, but it's somewhat too complicated (in terms of performance). In fact you would not only need to check the tiles nearby, but if the tiles in the neighbouring are all the same (like in the sky for example) you need to go further and find an "edge" where the tile differs. Also it's not the case here but imagine the screen is scrolling and the door is cut-off to the left of the screen (or right, same) we wouldn't be able to find the next black tile in one direction or the other. :(