Well, the code you posted doesn't make any sense to me. I can't figure out why you are moving building\x. Obviously when a person runs into a building, the building usually stays in place :)
Anyways, I think you would be better off detecting a collision, and then quickly running through a loop that backs up the player 1 pixel at a time until there is no collision. This means that the player is right next to the wall instead of standing away from it when a collision is detected. Also, you can do this by backing up along the direction of travel, so you do not have to do a seperate check for every direction.
Sorry I don't have time to knock up any code, but hopefully that gives you a direction to head in.
Anyways, I think you would be better off detecting a collision, and then quickly running through a loop that backs up the player 1 pixel at a time until there is no collision. This means that the player is right next to the wall instead of standing away from it when a collision is detected. Also, you can do this by backing up along the direction of travel, so you do not have to do a seperate check for every direction.
Sorry I don't have time to knock up any code, but hopefully that gives you a direction to head in.