This website uses cookies.Before continuing to use our website, you agree and accept Privacy policy.Accept

Simple Pacman made with AI


Use the arrow keys to move. Collect all the stars.


PC - Smartphone



DESCRIPTION

I created a Pac-Man-style game using AI.

Collect all the stars without getting caught by the enemies chasing you.

HOW TO MAKE/PROMPT

Created using Claude sonnet. The prompt was as follows:
Make a Pacman HTML game
#structure
- html,js,css in 1 file
- 512x512 canvas,max-widt:100%

#Script
##Variables
numOfEnemy: 3 // Number of enemies
numOfStar: 3 // Number of stars

##Initialization
The internal grid is 10x10.
The layout resembles a simple maze.
The game elements are represented using emojis.
numOfStar stars are placed randomly on the grid.
numOfEnemy enemies are placed randomly on the grid.
A reset button is placed at the bottom of the screen.

##Loop Processing
The player moves continuously while the arrow keys are pressed. avoid window scrolling via arrow keys.
The numOfEnemy enemies move one step every second, and they chase the player once they spot them.
The game ends if the player is caught by an enemy (game over).
The game is won if the player collects all the stars (game clear).

What if there is an error?




<< menu

On-site search