How do I get a 4-way linear movement with a slide?

Try this:

This will allow you to change direction only once the pawn has bumped into something.