A collapse transition in a directed walk model