script avoids obstacles and goes forward