Details of the project can be found in this guide.
The basic game engine and graphics were supplied by Udacity. Game logic and features such as lives and high score were developed by me.
This repository was cloned from this Udacity repository. So you can see exactly what was my starting point.
Required Libraries and Dependencies
You will need a modern web browser that supports HTML5 to play this game. You also need a keyboard (the arrow keys allow you to move the player around the screen).
This project consists for the following files:
index.html- load this file in a web browser to play the game
js/app.js- main JS file that instantiates the enemy and player objects
js/enemy.js- defines the Enemy class
js/engine.js- contains the main game loop and manages game rendering
js/gameentity.js- abstract class for all game entities
js/gem.js- defines the Gem class for the behavior of gems
js/player.js- defines the Player class
js/resources.js- handles the loading and caching of graphics
js/libs/closure-complier/- Google's Closure Compiler is included here
images/- directory containing game graphics
css/style.css- style sheet for the web page holding the game
cd js/build ./compile.sh
game.min.js in the
If you want to go back to development mode, simply delete this file.
On Windows, take the command in
compile.sh and run it after changing the
forward slashes for backward slashes.
How to Run the Project
index.html in a modern web browser that supports HTML5, served from
a web server.
If you want to test the game locally and have Python installed, do the following
in the directory where
python -m SimpleHTTPServer
Then navigate you browser to
0.0.0.0:8000 to test the game.
In going beyond the instructions I added the following features:
- multiple levels, with each level containing one extra enemy
- a number of lives for the player before starting the game again at level 1
- high score that is saved in the users browser using localStorage