If our character is facing a wall, he will need to know that he cannot pass through that wall and should choose another option. Unless we allow the character to climb the wall or destroy it, the character will need to face a new direction that is not blocked and walk in that new unblocked direction.
We will start with a simple approach that i can be often very useful, and is perhaps the best option, depending on the type of game that we are creating. In the example that we'll be demonstrating, the character in question needs to keep moving around the level just like the Pac-Man enemies. Starting with a basic example, we give our character the freedom to choose which direction to move in, and later on we will add ...