Adjusted the checkBoundaries function for the GameObjects