ziw / javascript-pacman Goto Github PK
View Code? Open in Web Editor NEWPac-Man in JS. No images were used; all graphics were coded in JS.
Pac-Man in JS. No images were used; all graphics were coded in JS.
..._ ____ ___ ________ ______ _ __ .' `. / __ \/ | / ____/ |/ / | / | / / : o _.-' / /_/ / /| |/ / / /|_/ / /| | / |/ / : `-._ / ____/ ___ / /___/ / / / ___ |/ /| / `. .' /_/ /_/ |_\____/_/ /_/_/ |_/_/ |_/ `-...-' Developed by: Zi Wang (ziw), Bingying Xia (bxia) //////// How to Play ///////// On welcome screen, press S to start the game. Use arrow keys or WASD to move, Q to pause, E to resume, and R to restart. Gaming mechanics is just like the original Pacman. In case you were living under a rock and doesn't know what Pacman is (or too young to know), here's a brief summary (of the parts that we implemented): - Eat pellets to earn points. - Don't get eaten by ghosts or you'll die a very painful death. - Eat power pellets to briefly enter freight mode, where you can take revenge. - Each ghost has a different personality, so study it well to win. Scoring is as follows: - 10 pts for each pellet - 50 pts for each power pellet - 200 for the first ghost eaten in freight mode, double the previous score for each additional ghost eaten in the same occurance of freight mode (i.e. 200 for the 1st, 400 for the 2nd, 800 for the 3rd, resets for every freight mode). *******!!! SUPER ULTRA SECRET CHEAT !!!******* * Press G at start screen to enter GOD MODE. * * (You didn't hear it from us.) * ********************************************** References used for gaming mechanics: Understanding Pac-Man Ghost Behavior -- GameIntervals http://gameinternals.com/post/2072558330/understanding-pac-man-ghost-behavior The Pac-Man Dossier -- Jamie Pittman http://home.comcast.net/~jpittman2/pacman/pacmandossier.html //////// Concepts Used ///////// JavaScript - Function callbacks setInterval() used to refresh game, setTimeOut() used to pause screen shortly during countdown to start. - Anonymous function Used with setTimeOut during countdown. - Optional parameters Run() takes an optional parameter of isGodMode to determine whether or not to enter god mode. - Arrays Used for constructing game board grids (2-D array), keeping record of ghosts and lives left, and an assortment of other various elements. - Objects Pacman, ghosts, and grids are all objects. They have constructors, properties, parameters, prototypes, overridden toString() methods, etc. HTML5 Canvas - Rectangles, rectangles everywhere. Used for grids, covering up areas that need to be refreshed, etc. - Strokes and fills For drawing everything. - Paths, arcs, circles For drawing Pacman and ghosts. - Text For showing welcome screen, instructions, and scores. - Keyboard events Used to make Pacman move.
Would you mind to put it under an oss licence?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.