pacman.mp4
Click to visit the github page for this repository
-
This exercise uses four images of the classic PacMan as shown above.
-
Each set has two images - one with mouth open and the another with mouth closed.
-
Flipping between values 0 and 1 helps the PacMan to change direction.
-
The same is used for simulation of PacMan opening and closing mouth.
-
Run() function is called on mouse click and every time it is called, it updates the PacMan image, position and direction on the screen.
-
setInterval() will call the Run() function every 200 milliseconds to keep it going.
-
checkPageBounds function allow PacMan to reverse his trajectory once the PacMan hits the edge of the screen on the x-axis.
In order to run this file,
-
Fork and Clone the repository to your local machine.
-
Drag and drop index.html file in a browser tab.
This project can be still be enhanced by
-
making the pacman to randomly change velocity.
-
making more pacmen.
This exercise stems from MIT xPRO Professional Certificate in Coding: Full Stack Development with MERN Program
MIT License Copyright (c) 2022 Sujatha Arunagiri Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.