In the last section we got all of the maze sprites in their correct locations. Problem is some of the sprites didn't look right because we need to rotate some of them. Once we get those sprites rotated, we'll be able to turn off the nodes and then reposition Pacman and the ghosts.
The only way we can specify which maze sprite needs to be rotated we'll create another text file where it looks more or less like the maze1.txt file but this time it will contain values 0-3 which is what we'll use to know how much to rotate a sprite.
This file tells how to rotate each sprite.
0: no rotation
1: rotate 90 degrees
2: rotate 180 degrees
3: rotate 270 degrees
We'll modify the MazeSprites class so that we can rotate the sprites according to the file above.
All we need to do in the GameController class is include the maze1_rotation.txt file.
Now if you run the game you'll get something similar to what we see on the right. Just like magic all of the maze sprites are oriented correctly. We can go ahead and get rid of the nodes and lines now. We won't actually get rid of them, we just won't draw them. They're still there because they need to be for the game to work. We just don't need to see them anymore.
Now that looks a lot better. Only thing now is that Pacman, the ghosts, and the pellets look off. This is to be expected though, so we just need to adjust their positions.
Remember in a previous section I explained why they'll appear off when we start to use sprites? I also explained how we were going to fix it. So let's fix it now. We need to fix Pacman, the ghosts, the fruit, and the pellets.
There! Everything looks really good now. You'll also notice that I reduced the size of the pellets. They were too large before. We had to make them that large because we wouldn't have been able to see them otherwise when we were drawing the nodes and the lines.
It almost looks like our game is complete doesn't it? There is one issue though. Nothing animates. Sure we can move Pacman around and the ghosts move around on their own as well, but we need to see Pacman actually opening and closing his mouth as he's moving around and also facing the direction he's moving. That's all taken care of in the next section.