Game help

I am making a game where you move the background and it looks like your guy moves. In my background I have trees and house. I need a code to make it so that when the house or tree on the background hits the guy the background stops to move . so that the guy does not go through the house or tree.