Representing walls in a Pac-Man maze
I am making a Pac-Man clone in C++. I implemented the maze as a graph, where each node is at an intersection. I figured this would be the best choice for movement along the maze, and it worked fine until I got to the point where Pac-Man could eat the ghosts.
When Pac-Man eats a ghost, its speed quadruples (which equates to 2x its original speed), and it tries to find its way back to the center to return it to its normal state. Unfortunately, they move so fast that they tend to overshoot the nodes, allowing them to go through the walls and off the maze. I've tried various methods to solve this problem, but none of them have worked. On one such attempt, if a ghost is approaching an intersection and would overshoot it, I merely place the ghost on that node for the next frame. Unfortunately, this causes the ghost to lock onto the node and stop moving.
Any suggestions for how I should solve this problem?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement