Directional locking of magnetically interacting colloidal particles