Well for the borders I just put a limit on the x and y axis and for trees and other sprites I used this code in the pic :D