Hey @xinox096,
Essentially the suggestions works like this. You have, I am assuming, 4 states, forward, backward, right, and left. You would use an enumeration to keep track of the current state (for example when you look back). At that point you would use a switch to determine what the next action would be based on your direction. Here is a rudimentary example of what that may look like when getting started: