changed so that a direction is set when player moves