feat: pathfinding for ghosts, add debug rendering of paths

This commit is contained in:
2025-08-11 15:25:39 -05:00
parent ad2ec35bfb
commit d9c8f97903
4 changed files with 216 additions and 0 deletions

View File

@@ -111,6 +111,17 @@ impl Pacman {
}
}
/// Returns the current node ID that Pac-Man is at or moving towards.
///
/// If Pac-Man is at a node, returns that node ID.
/// If Pac-Man is between nodes, returns the node it's moving towards.
pub fn current_node_id(&self) -> NodeId {
match self.traverser.position {
Position::AtNode(node_id) => node_id,
Position::BetweenNodes { to, .. } => to,
}
}
/// Renders Pac-Man to the canvas.
///
/// Calculates screen position, determines if Pac-Man is stopped,