This exercise was about creating a game with PacMen. When the „Add PacMan“ button is clicked, a PacMan appears at a random position. Repeat as many times as you like. The game is then started by by clicking on „Start Game“ – the PacMen start to move at a random velocity. The exercise was to set the position of the PacMan, to detect collision with all walls and to make each PacMan bounce off of them. The goal was also to learn on how to control the Document Object Model (DOM).
You can download or fork this repository. To start the game you can open the index.html file in a browser of your choice. If you want to use the code you can edit it in a code editor of your choice. It contains two images of a pacman facing to the right and two facing to the left, an index.html file and a pacmen.js file. The file structure is the following:
- images/pacman1.png
- images/pacman2.png
- images/pacman3.png
- images/pacman4.png
- index.html
- pacmen.js
- change direction on wall collision
- implement possibility to decrease the PacMen one by one
- add a stop Button
PacMen Exercise is free and open source. You can use it for commercial projects, open source projects, or for (almost) anything you want. The MIT License applies to all files.