How eldanveloper/pac-man works
Project type and purpose
• This is a single-page, front-end web game (“Pacman”) built entirely in HTML, CSS (via assets), and vanilla JavaScript.
• There is no backend or server-side logic beyond serving the static files; all game logic, rendering, and state management lives in the browser.
File structure
• index.html: entry point—the HTML scaffold that loads the scripts and assets.
• assets/: contains images, audio, sprites used by the game.
• game.js: the main orchestrator—initializes the canvas, game loop, map, score, win/lose conditions, restart logic.
• pacman.js: encapsulates Pac-Man’s state (position, speed, lives), input handling (keyboard events), movement, collision detection, rendering.
• ghost.js: encapsulates each ghost’s AI (movement patterns, target logic, speed), collision detection, rendering.
README for additional insights
• Confirms modular design: one file per major component (game engine, Pac-Man, ghosts).
• Emphasizes JavaScript, HTML, and static asset usage.
• No external services, APIs, or server dependencies.
Detail without overthinking
• Break the system into as many logical components as it contains (loader, engine, input, entities, assets, renderer).