character changes direction based on input