Can the basin drain pipe be offset from the pipe going into the wall?

As long as the pipe going into the wall is straight, the rest of the drain pipe can be routed however it needs to be. Very often the trap is at an angle to the pipe in the wall.