Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 39627
In Process

askthedev.com Latest Questions

Asked: June 6, 20252025-06-06T00:14:13+05:30 2025-06-06T00:14:13+05:30

How does collision detection, specifically regarding dot consumption and cornering, work in the original Pac-Man game?

anonymous user

I’ve been diving into recreating a faithful version of Pac-Man as a side project to learn more about the Rust Bevy framework, and I’ve hit a bit of a snag with how collision detection works, especially when it comes to the whole “cornering” mechanic. I came across this concept in the official Pac-Man dossier, which explains that when Pac-Man makes a turn, he speeds up at a 45-degree angle and effectively doubles his speed. This is all super cool because it allows for outmaneuvering ghosts, but it’s left me scratching my head regarding the nitty-gritty of how dot consumption is handled during these turns.

From what I understand, Pac-Man needs to be centered on a tile to eat a dot or energizer. But here’s where I get confused: when he’s cornering and moving diagonally, it seems like he might never really be in the center of a tile to register that sweet dot-eating action. I can think of a couple of possible ways this could work:

1. Maybe Pac-Man eats a dot after he’s moved a specified number of pixels into a tile, as long as he hasn’t done a sudden U-turn?
2. Or perhaps it’s as soon as he’s in a tile with a dot, but that feels like it could lead to some odd visual behavior, right?

So, I’ve got a few questions bouncing around in my head:

– When does Pac-Man actually eat a dot or energizer? Is it a specific pixel threshold, or is it purely spatial?
– How does his “logical” position work while he’s in the middle of cornering? Are there any positional calculations happening behind the scenes?
– And what about the “visual” position? Does that behave differently, especially when he’s zipping around corners?

If anyone has some insight or resources on these points, I’d love to hear your thoughts! This would really help me get a better handle on recreating that classic gameplay feel!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2025-06-06T00:14:15+05:30Added an answer on June 6, 2025 at 12:14 am

      It sounds like you’re diving into some cool aspects of game development with your Pac-Man project!

      Regarding your questions on dot consumption during cornering, here are some thoughts:

      1. When does Pac-Man eat a dot or energizer?

      You’re right that he needs to be centered on a tile to eat a dot, but you could implement a system where he eats a dot when he enters a tile, as long as he’s moving forward. This way, as soon as his hitbox (the area you check for collisions) crosses into the tile, you could trigger the dot consumption. You could also define a small threshold, say, a few pixels, so he doesn’t have to be perfectly centered, allowing for a bit of leeway during cornering.

      2. How does his “logical” position work while cornering?

      When Pac-Man is cornering, you might want to maintain a separate “logical” position that checks for tile boundaries. This could be a bit of math behind the scenes—tracking his position as he moves to see if he enters a new tile. You could also use a grid-based system where you snap his position to the grid on movements, making it easier to manage his tile interactions.

      3. What about the “visual” position?

      For the visual aspect, it might indeed behave differently since he’s moving faster during turns. You can render him smoothly while maintaining his logical position. Think of it as two layers: one for how he looks on screen (the visual position) and another for his collision checks (the logical position). This will help avoid any awkward visual bugs where he “jumps” over dots.

      Combining these approaches can help mimic that classic Pac-Man feel while giving you flexibility in how collisions and movement work. It’s totally fine to experiment and tweak things as you go! Good luck with your project!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2025-06-06T00:14:16+05:30Added an answer on June 6, 2025 at 12:14 am

      In the original Pac-Man gameplay mechanics, dot consumption logic primarily hinges on Pac-Man’s “tile occupancy” rather than strict pixel alignment. While Pac-Man visually moves smoothly across the board, logically he occupies one tile at a time. During cornering, although the animation shows him accelerating diagonally at 45 degrees (effectively doubling his speed momentarily), internally Pac-Man’s logical position updates tile-to-tile. Specifically, dots and energizers get consumed the exact moment Pac-Man’s logical coordinate transitions into a new tile keyed as containing a dot, not necessarily waiting until he’s visually centered. Thus, there isn’t a rigid pixel threshold for dot consumption; it’s intrinsically tied to the tile Pac-Man occupies logically.

      Regarding the visual and logical positions during cornering, the game typically keeps two separate position trackers: one for rendering smooth animations (visual), and another to handle game logic events (logical). The logical position updates discretely and is responsible for real-time collision detection, dot consumption, and ghost interactions. Meanwhile, the visual position interpolates Pac-Man’s sprite movement smoothly across the tiles, effectively showing that diagonal acceleration during corner turning. This separation ensures seamless visual navigation, while preserving precise and predictable mechanics for gameplay logic.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.