This project is a Pacman game developed with a Spring Boot backend and a React frontend. The backend provides APIs to generate the game board and handle Pacman's movements, while the frontend handles the game's user interface and interactions.
- Java 17 or later
- Maven
- Node.js and npm
-
Clone the repository:
git clone https://github.com/JohannBulls/Pac-Man.git cd Pac-Man -
Navigate to the backend directory:
cd springpacman -
Build the project using Maven:
mvn clean install
-
Run the Spring Boot application:
mvn spring-boot:run
The backend server will start and listen on port
8080by default.
-
Navigate to the React directory:
cd ../reactpacman -
Install the required npm packages:
npm install
-
Start the React application:
npm start
The React application will start and should be accessible at
http://localhost:3000.
MoveRequestClass: Handles requests related to Pacman's movements, including the direction of movement.PacmanControllerClass: Provides endpoints to start the game and to handle Pacman's movements. It processes the direction and returns responses indicating the result of the movement or any errors.SpringpacmanApplicationClass: The entry point of the Spring Boot application, responsible for starting the application.WebConfigClass: Configures CORS (Cross-Origin Resource Sharing) to allow requests from the React frontend running on a different port.
AppComponent: Manages the game state, including the board, Pacman, and ghost positions. It handles user input, communicates with the backend API to move Pacman, and manages game music.BoardComponent: Renders the game board on a canvas, displaying Pacman and the ghost using images. It updates the canvas whenever the board or the positions of Pacman and the ghost change.
-
Start the Backend:
Make sure the Spring Boot application is running. It should be accessible at
http://localhost:8080. -
Start the Frontend:
Ensure the React application is running. It should be accessible at
http://localhost:3000. -
Interacting with the Game:
- Use the arrow keys (
w,a,s,d) to move Pacman around the board. - The game will alert you if Pacman is caught by the ghost.
- Use the arrow keys (
This project is licensed under the MIT License - see the LICENSE file for details.


