├── .replit
├── .htaccess
├── js
├── .htaccess
├── helper.js
├── resources.js
├── engine.js
├── app.js
├── underscore-min.js
└── hammer.min.js
├── css
├── .htaccess
└── style.css
├── fonts
├── .htaccess
├── indieflower.ttf
├── indieflower.woff
├── indieflower-webfont.eot
├── indieflower-webfont.ttf
├── indieflower-webfont.woff
└── indieflower-webfont.woff2
├── icons
├── .htaccess
├── favicon.ico
├── apple-icon.png
├── favicon-16x16.png
├── favicon-32x32.png
├── favicon-96x96.png
├── ms-icon-70x70.png
├── apple-icon-57x57.png
├── apple-icon-60x60.png
├── apple-icon-72x72.png
├── apple-icon-76x76.png
├── ms-icon-144x144.png
├── ms-icon-150x150.png
├── ms-icon-310x310.png
├── android-icon-36x36.png
├── android-icon-48x48.png
├── android-icon-72x72.png
├── android-icon-96x96.png
├── apple-icon-114x114.png
├── apple-icon-120x120.png
├── apple-icon-144x144.png
├── apple-icon-152x152.png
├── apple-icon-180x180.png
├── android-icon-144x144.png
├── android-icon-192x192.png
├── apple-icon-precomposed.png
├── browserconfig.xml
└── manifest.json
├── images
├── .htaccess
├── bg.png
├── Heart.png
├── Key.png
├── Rock.png
├── Star.png
├── bg2.png
├── cb-rl.png
├── cb-rr.png
├── cb-up.png
├── fence.png
├── red.png
├── trnsp.png
├── wu-rl.png
├── wu-rr.png
├── wu-up.png
├── cb-down.png
├── cb-fall.png
├── cb-idle.png
├── flowers.png
├── full-bg.png
├── gb-test.png
├── layer_2.png
├── water2.png
├── wu-down.png
├── wu-grin.png
├── wu-hit.png
├── wu-hit2.png
├── wu-idle.png
├── wu-up-c.png
├── Gem Blue.png
├── Gem Green.png
├── Gem Orange.png
├── Selector.png
├── cb-joy-up.png
├── char-boy.png
├── kitty-tux.png
├── wu-down-c.png
├── wu-joy-l.png
├── wu-joy-r.png
├── cb-idle copy.png
├── cb-joy-down.png
├── grass-block.png
├── grass-block2.png
├── grass-block3.png
├── grass-block4.png
├── grass-block5.png
├── stone-block.png
├── stone-block2.png
├── water-block.png
├── water-block2.png
├── water-block3.png
├── water-block4.png
├── water-block5.png
├── evil-flower-1.png
├── evil-flower-2.png
├── evil-red-flower-1.png
├── evil-red-flower-2.png
├── evil-blue-flower-1.png
├── Internet_Explorer_9_icon.svg
└── bd-tools.svg
├── sounds
├── .htaccess
├── round_end.wav
└── pacmanwakka.wav
├── favicon.ico
├── jsDocFiles
├── fonts
│ ├── OpenSans-Bold-webfont.eot
│ ├── OpenSans-Bold-webfont.woff
│ ├── OpenSans-Light-webfont.eot
│ ├── OpenSans-Italic-webfont.eot
│ ├── OpenSans-Italic-webfont.woff
│ ├── OpenSans-Light-webfont.woff
│ ├── OpenSans-Regular-webfont.eot
│ ├── OpenSans-Regular-webfont.woff
│ ├── OpenSans-BoldItalic-webfont.eot
│ ├── OpenSans-BoldItalic-webfont.woff
│ ├── OpenSans-LightItalic-webfont.eot
│ └── OpenSans-LightItalic-webfont.woff
├── scripts
│ ├── linenumber.js
│ └── prettify
│ │ ├── lang-css.js
│ │ ├── Apache-License-2.0.txt
│ │ └── prettify.js
├── styles
│ ├── prettify-jsdoc.css
│ ├── prettify-tomorrow.css
│ └── jsdoc-default.css
├── Scoreboard.html
├── index.html
├── Player.html
├── Enemy.html
└── app.js.html
├── .gitignore
├── manifest.json
├── index.html
└── README.md
/.replit:
--------------------------------------------------------------------------------
1 | language = "html"
--------------------------------------------------------------------------------
/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/js/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/css/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/fonts/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/icons/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/images/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/sounds/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/favicon.ico
--------------------------------------------------------------------------------
/images/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/bg.png
--------------------------------------------------------------------------------
/images/Heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Heart.png
--------------------------------------------------------------------------------
/images/Key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Key.png
--------------------------------------------------------------------------------
/images/Rock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Rock.png
--------------------------------------------------------------------------------
/images/Star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Star.png
--------------------------------------------------------------------------------
/images/bg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/bg2.png
--------------------------------------------------------------------------------
/images/cb-rl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-rl.png
--------------------------------------------------------------------------------
/images/cb-rr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-rr.png
--------------------------------------------------------------------------------
/images/cb-up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-up.png
--------------------------------------------------------------------------------
/images/fence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/fence.png
--------------------------------------------------------------------------------
/images/red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/red.png
--------------------------------------------------------------------------------
/images/trnsp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/trnsp.png
--------------------------------------------------------------------------------
/images/wu-rl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-rl.png
--------------------------------------------------------------------------------
/images/wu-rr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-rr.png
--------------------------------------------------------------------------------
/images/wu-up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-up.png
--------------------------------------------------------------------------------
/icons/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/favicon.ico
--------------------------------------------------------------------------------
/images/cb-down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-down.png
--------------------------------------------------------------------------------
/images/cb-fall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-fall.png
--------------------------------------------------------------------------------
/images/cb-idle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-idle.png
--------------------------------------------------------------------------------
/images/flowers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/flowers.png
--------------------------------------------------------------------------------
/images/full-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/full-bg.png
--------------------------------------------------------------------------------
/images/gb-test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/gb-test.png
--------------------------------------------------------------------------------
/images/layer_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/layer_2.png
--------------------------------------------------------------------------------
/images/water2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/water2.png
--------------------------------------------------------------------------------
/images/wu-down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-down.png
--------------------------------------------------------------------------------
/images/wu-grin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-grin.png
--------------------------------------------------------------------------------
/images/wu-hit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-hit.png
--------------------------------------------------------------------------------
/images/wu-hit2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-hit2.png
--------------------------------------------------------------------------------
/images/wu-idle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-idle.png
--------------------------------------------------------------------------------
/images/wu-up-c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-up-c.png
--------------------------------------------------------------------------------
/fonts/indieflower.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/fonts/indieflower.ttf
--------------------------------------------------------------------------------
/icons/apple-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon.png
--------------------------------------------------------------------------------
/images/Gem Blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Gem Blue.png
--------------------------------------------------------------------------------
/images/Gem Green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Gem Green.png
--------------------------------------------------------------------------------
/images/Gem Orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Gem Orange.png
--------------------------------------------------------------------------------
/images/Selector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/Selector.png
--------------------------------------------------------------------------------
/images/cb-joy-up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-joy-up.png
--------------------------------------------------------------------------------
/images/char-boy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/char-boy.png
--------------------------------------------------------------------------------
/images/kitty-tux.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/kitty-tux.png
--------------------------------------------------------------------------------
/images/wu-down-c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-down-c.png
--------------------------------------------------------------------------------
/images/wu-joy-l.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-joy-l.png
--------------------------------------------------------------------------------
/images/wu-joy-r.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/wu-joy-r.png
--------------------------------------------------------------------------------
/sounds/round_end.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/sounds/round_end.wav
--------------------------------------------------------------------------------
/fonts/indieflower.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/fonts/indieflower.woff
--------------------------------------------------------------------------------
/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/icons/favicon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/favicon-96x96.png
--------------------------------------------------------------------------------
/icons/ms-icon-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/ms-icon-70x70.png
--------------------------------------------------------------------------------
/images/cb-idle copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-idle copy.png
--------------------------------------------------------------------------------
/images/cb-joy-down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/cb-joy-down.png
--------------------------------------------------------------------------------
/images/grass-block.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/grass-block.png
--------------------------------------------------------------------------------
/images/grass-block2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/grass-block2.png
--------------------------------------------------------------------------------
/images/grass-block3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/grass-block3.png
--------------------------------------------------------------------------------
/images/grass-block4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/grass-block4.png
--------------------------------------------------------------------------------
/images/grass-block5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/grass-block5.png
--------------------------------------------------------------------------------
/images/stone-block.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/stone-block.png
--------------------------------------------------------------------------------
/images/stone-block2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/stone-block2.png
--------------------------------------------------------------------------------
/images/water-block.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/water-block.png
--------------------------------------------------------------------------------
/images/water-block2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/water-block2.png
--------------------------------------------------------------------------------
/images/water-block3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/water-block3.png
--------------------------------------------------------------------------------
/images/water-block4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/water-block4.png
--------------------------------------------------------------------------------
/images/water-block5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/water-block5.png
--------------------------------------------------------------------------------
/sounds/pacmanwakka.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/sounds/pacmanwakka.wav
--------------------------------------------------------------------------------
/icons/apple-icon-57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-57x57.png
--------------------------------------------------------------------------------
/icons/apple-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-60x60.png
--------------------------------------------------------------------------------
/icons/apple-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-72x72.png
--------------------------------------------------------------------------------
/icons/apple-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-76x76.png
--------------------------------------------------------------------------------
/icons/ms-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/ms-icon-144x144.png
--------------------------------------------------------------------------------
/icons/ms-icon-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/ms-icon-150x150.png
--------------------------------------------------------------------------------
/icons/ms-icon-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/ms-icon-310x310.png
--------------------------------------------------------------------------------
/images/evil-flower-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/evil-flower-1.png
--------------------------------------------------------------------------------
/images/evil-flower-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/evil-flower-2.png
--------------------------------------------------------------------------------
/icons/android-icon-36x36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/android-icon-36x36.png
--------------------------------------------------------------------------------
/icons/android-icon-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/android-icon-48x48.png
--------------------------------------------------------------------------------
/icons/android-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/android-icon-72x72.png
--------------------------------------------------------------------------------
/icons/android-icon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/android-icon-96x96.png
--------------------------------------------------------------------------------
/icons/apple-icon-114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-114x114.png
--------------------------------------------------------------------------------
/icons/apple-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-120x120.png
--------------------------------------------------------------------------------
/icons/apple-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-144x144.png
--------------------------------------------------------------------------------
/icons/apple-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-152x152.png
--------------------------------------------------------------------------------
/icons/apple-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-180x180.png
--------------------------------------------------------------------------------
/images/evil-red-flower-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/evil-red-flower-1.png
--------------------------------------------------------------------------------
/images/evil-red-flower-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/evil-red-flower-2.png
--------------------------------------------------------------------------------
/fonts/indieflower-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/fonts/indieflower-webfont.eot
--------------------------------------------------------------------------------
/fonts/indieflower-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/fonts/indieflower-webfont.ttf
--------------------------------------------------------------------------------
/fonts/indieflower-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/fonts/indieflower-webfont.woff
--------------------------------------------------------------------------------
/fonts/indieflower-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/fonts/indieflower-webfont.woff2
--------------------------------------------------------------------------------
/icons/android-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/android-icon-144x144.png
--------------------------------------------------------------------------------
/icons/android-icon-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/android-icon-192x192.png
--------------------------------------------------------------------------------
/images/evil-blue-flower-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/images/evil-blue-flower-1.png
--------------------------------------------------------------------------------
/icons/apple-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/icons/apple-icon-precomposed.png
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Bold-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Bold-webfont.eot
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Bold-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Bold-webfont.woff
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Light-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Light-webfont.eot
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Italic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Italic-webfont.eot
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Italic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Italic-webfont.woff
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Light-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Light-webfont.woff
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Regular-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Regular-webfont.eot
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-Regular-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-Regular-webfont.woff
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-BoldItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-BoldItalic-webfont.eot
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-BoldItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-BoldItalic-webfont.woff
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-LightItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-LightItalic-webfont.eot
--------------------------------------------------------------------------------
/jsDocFiles/fonts/OpenSans-LightItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/replit/abcd-amasad/master/jsDocFiles/fonts/OpenSans-LightItalic-webfont.woff
--------------------------------------------------------------------------------
/icons/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 | #ffffff
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .AppleDouble
3 | .LSOverride
4 |
5 | # Icon must end with two \r
6 | Icon
7 |
8 |
9 | # Thumbnails
10 | ._*
11 |
12 | # Files that might appear in the root of a volume
13 | .DocumentRevisions-V100
14 | .fseventsd
15 | .Spotlight-V100
16 | .TemporaryItems
17 | .Trashes
18 | .VolumeIcon.icns
19 |
20 | # Directories potentially created on remote AFP share
21 | .AppleDB
22 | .AppleDesktop
23 | Network Trash Folder
24 | Temporary Items
25 | .apdisk
26 |
27 | # Other Stuff
28 | *.zip
29 | *.gz
30 | *.psd
31 | *.ai
32 | *.indd
33 | *.idml
34 | *.bak
35 |
--------------------------------------------------------------------------------
/jsDocFiles/scripts/linenumber.js:
--------------------------------------------------------------------------------
1 | /*global document */
2 | (function() {
3 | var source = document.getElementsByClassName('prettyprint source linenums');
4 | var i = 0;
5 | var lineNumber = 0;
6 | var lineId;
7 | var lines;
8 | var totalLines;
9 | var anchorHash;
10 |
11 | if (source && source[0]) {
12 | anchorHash = document.location.hash.substring(1);
13 | lines = source[0].getElementsByTagName('li');
14 | totalLines = lines.length;
15 |
16 | for (; i < totalLines; i++) {
17 | lineNumber++;
18 | lineId = 'line' + lineNumber;
19 | lines[i].id = lineId;
20 | if (lineId === anchorHash) {
21 | lines[i].className += ' selected';
22 | }
23 | }
24 | }
25 | })();
26 |
--------------------------------------------------------------------------------
/jsDocFiles/scripts/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
3 |
--------------------------------------------------------------------------------
/icons/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "App",
3 | "icons": [
4 | {
5 | "src": "\/android-icon-36x36.png",
6 | "sizes": "36x36",
7 | "type": "image\/png",
8 | "density": "0.75"
9 | },
10 | {
11 | "src": "\/android-icon-48x48.png",
12 | "sizes": "48x48",
13 | "type": "image\/png",
14 | "density": "1.0"
15 | },
16 | {
17 | "src": "\/android-icon-72x72.png",
18 | "sizes": "72x72",
19 | "type": "image\/png",
20 | "density": "1.5"
21 | },
22 | {
23 | "src": "\/android-icon-96x96.png",
24 | "sizes": "96x96",
25 | "type": "image\/png",
26 | "density": "2.0"
27 | },
28 | {
29 | "src": "\/android-icon-144x144.png",
30 | "sizes": "144x144",
31 | "type": "image\/png",
32 | "density": "3.0"
33 | },
34 | {
35 | "src": "\/android-icon-192x192.png",
36 | "sizes": "192x192",
37 | "type": "image\/png",
38 | "density": "4.0"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Arcade",
3 | "name": "Arcade Game",
4 | "icons": [
5 | {
6 | "src": "icons\/android-icon-36x36.png",
7 | "sizes": "36x36",
8 | "type": "image\/png",
9 | "density": "0.75"
10 | },
11 | {
12 | "src": "icons\/android-icon-48x48.png",
13 | "sizes": "48x48",
14 | "type": "image\/png",
15 | "density": "1.0"
16 | },
17 | {
18 | "src": "icons\/android-icon-72x72.png",
19 | "sizes": "72x72",
20 | "type": "image\/png",
21 | "density": "1.5"
22 | },
23 | {
24 | "src": "icons\/android-icon-96x96.png",
25 | "sizes": "96x96",
26 | "type": "image\/png",
27 | "density": "2.0"
28 | },
29 | {
30 | "src": "icons\/android-icon-144x144.png",
31 | "sizes": "144x144",
32 | "type": "image\/png",
33 | "density": "3.0"
34 | },
35 | {
36 | "src": "icons\/android-icon-192x192.png",
37 | "sizes": "192x192",
38 | "type": "image\/png",
39 | "density": "4.0"
40 | }
41 | ],
42 | "start_url": "index.html",
43 | "display": "standalone",
44 | "orientation": "landscape"
45 | }
46 |
--------------------------------------------------------------------------------
/css/style.css:
--------------------------------------------------------------------------------
1 | /* 2015-09-09 C. Teeters
2 | *
3 | */
4 |
5 | @font-face {
6 | font-family: "Indie Flower";
7 | src: url(../fonts/indieflower-webfont.eot);
8 | src: url(../fonts/indieflower-webfont.eot?#iefix) format("embedded-opentype"), url(../fonts/indieflower-webfont.woff2) format("woff2"), url(../fonts/indieflower-webfont.woff) format("woff"), url(../fonts/indieflower-webfont.ttf) format("truetype"), url(../fonts/indieflower-webfont.svg#indie_flowerregular) format("svg");
9 | }
10 |
11 | body {
12 | font-family: "Lato", sans-serif;
13 | color: #efeeea;
14 | background-color: #4e4e4e;
15 | text-align: center;
16 | width: 80%;
17 | }
18 |
19 | h1,
20 | h2,
21 | h3,
22 | h4 {
23 | font-family: "Indie Flower", sans-serif;
24 | color: #efeeea;
25 | letter-spacing: 2px;
26 | line-height: 1.5;
27 | }
28 | /*
29 | * Force Landscape
30 | */
31 | #force-landscape { display:block; }
32 | @media only screen and (orientation:portrait){
33 | #container {
34 | height: 100vw;
35 | -webkit-transform: rotate(90deg);
36 | -moz-transform: rotate(90deg);
37 | -o-transform: rotate(90deg);
38 | -ms-transform: rotate(90deg);
39 | transform: rotate(90deg);
40 | }
41 | }
42 | @media only screen and (orientation:landscape){
43 | #container {
44 | -webkit-transform: rotate(0deg);
45 | -moz-transform: rotate(0deg);
46 | -o-transform: rotate(0deg);
47 | -ms-transform: rotate(0deg);
48 | transform: rotate(0deg);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/jsDocFiles/styles/prettify-jsdoc.css:
--------------------------------------------------------------------------------
1 | /* JSDoc prettify.js theme */
2 |
3 | /* plain text */
4 | .pln {
5 | color: #000000;
6 | font-weight: normal;
7 | font-style: normal;
8 | }
9 |
10 | /* string content */
11 | .str {
12 | color: #006400;
13 | font-weight: normal;
14 | font-style: normal;
15 | }
16 |
17 | /* a keyword */
18 | .kwd {
19 | color: #000000;
20 | font-weight: bold;
21 | font-style: normal;
22 | }
23 |
24 | /* a comment */
25 | .com {
26 | font-weight: normal;
27 | font-style: italic;
28 | }
29 |
30 | /* a type name */
31 | .typ {
32 | color: #000000;
33 | font-weight: normal;
34 | font-style: normal;
35 | }
36 |
37 | /* a literal value */
38 | .lit {
39 | color: #006400;
40 | font-weight: normal;
41 | font-style: normal;
42 | }
43 |
44 | /* punctuation */
45 | .pun {
46 | color: #000000;
47 | font-weight: bold;
48 | font-style: normal;
49 | }
50 |
51 | /* lisp open bracket */
52 | .opn {
53 | color: #000000;
54 | font-weight: bold;
55 | font-style: normal;
56 | }
57 |
58 | /* lisp close bracket */
59 | .clo {
60 | color: #000000;
61 | font-weight: bold;
62 | font-style: normal;
63 | }
64 |
65 | /* a markup tag name */
66 | .tag {
67 | color: #006400;
68 | font-weight: normal;
69 | font-style: normal;
70 | }
71 |
72 | /* a markup attribute name */
73 | .atn {
74 | color: #006400;
75 | font-weight: normal;
76 | font-style: normal;
77 | }
78 |
79 | /* a markup attribute value */
80 | .atv {
81 | color: #006400;
82 | font-weight: normal;
83 | font-style: normal;
84 | }
85 |
86 | /* a declaration */
87 | .dec {
88 | color: #000000;
89 | font-weight: bold;
90 | font-style: normal;
91 | }
92 |
93 | /* a variable name */
94 | .var {
95 | color: #000000;
96 | font-weight: normal;
97 | font-style: normal;
98 | }
99 |
100 | /* a function name */
101 | .fun {
102 | color: #000000;
103 | font-weight: bold;
104 | font-style: normal;
105 | }
106 |
107 | /* Specify class=linenums on a pre to get line numbering */
108 | ol.linenums {
109 | margin-top: 0;
110 | margin-bottom: 0;
111 | }
112 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Classic Arcade Game Clone
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/jsDocFiles/styles/prettify-tomorrow.css:
--------------------------------------------------------------------------------
1 | /* Tomorrow Theme */
2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */
3 | /* Pretty printing styles. Used with prettify.js. */
4 | /* SPAN elements with the classes below are added by prettyprint. */
5 | /* plain text */
6 | .pln {
7 | color: #4d4d4c; }
8 |
9 | @media screen {
10 | /* string content */
11 | .str {
12 | color: #718c00; }
13 |
14 | /* a keyword */
15 | .kwd {
16 | color: #8959a8; }
17 |
18 | /* a comment */
19 | .com {
20 | color: #8e908c; }
21 |
22 | /* a type name */
23 | .typ {
24 | color: #4271ae; }
25 |
26 | /* a literal value */
27 | .lit {
28 | color: #f5871f; }
29 |
30 | /* punctuation */
31 | .pun {
32 | color: #4d4d4c; }
33 |
34 | /* lisp open bracket */
35 | .opn {
36 | color: #4d4d4c; }
37 |
38 | /* lisp close bracket */
39 | .clo {
40 | color: #4d4d4c; }
41 |
42 | /* a markup tag name */
43 | .tag {
44 | color: #c82829; }
45 |
46 | /* a markup attribute name */
47 | .atn {
48 | color: #f5871f; }
49 |
50 | /* a markup attribute value */
51 | .atv {
52 | color: #3e999f; }
53 |
54 | /* a declaration */
55 | .dec {
56 | color: #f5871f; }
57 |
58 | /* a variable name */
59 | .var {
60 | color: #c82829; }
61 |
62 | /* a function name */
63 | .fun {
64 | color: #4271ae; } }
65 | /* Use higher contrast and text-weight for printable form. */
66 | @media print, projection {
67 | .str {
68 | color: #060; }
69 |
70 | .kwd {
71 | color: #006;
72 | font-weight: bold; }
73 |
74 | .com {
75 | color: #600;
76 | font-style: italic; }
77 |
78 | .typ {
79 | color: #404;
80 | font-weight: bold; }
81 |
82 | .lit {
83 | color: #044; }
84 |
85 | .pun, .opn, .clo {
86 | color: #440; }
87 |
88 | .tag {
89 | color: #006;
90 | font-weight: bold; }
91 |
92 | .atn {
93 | color: #404; }
94 |
95 | .atv {
96 | color: #060; } }
97 | /* Style */
98 | /*
99 | pre.prettyprint {
100 | background: white;
101 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
102 | font-size: 12px;
103 | line-height: 1.5;
104 | border: 1px solid #ccc;
105 | padding: 10px; }
106 | */
107 |
108 | /* Specify class=linenums on a pre to get line numbering */
109 | ol.linenums {
110 | margin-top: 0;
111 | margin-bottom: 0; }
112 |
113 | /* IE indents via margin-left */
114 | li.L0,
115 | li.L1,
116 | li.L2,
117 | li.L3,
118 | li.L4,
119 | li.L5,
120 | li.L6,
121 | li.L7,
122 | li.L8,
123 | li.L9 {
124 | /* */ }
125 |
126 | /* Alternate shading for lines */
127 | li.L1,
128 | li.L3,
129 | li.L5,
130 | li.L7,
131 | li.L9 {
132 | /* */ }
133 |
--------------------------------------------------------------------------------
/images/Internet_Explorer_9_icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
40 |
43 |
44 |
46 |
47 |
48 |
49 |
50 |
51 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/jsDocFiles/Scoreboard.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSDoc: Class: Scoreboard
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Class: Scoreboard
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Scoreboard
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
new Scoreboard()
46 |
47 |
48 |
49 |
50 |
51 |
52 | Represents the game's scoreboard.
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | Source:
95 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | Methods
139 |
140 |
141 |
142 |
143 |
144 |
145 | update()
146 |
147 |
148 |
149 |
150 |
151 |
152 | Update the player's score.
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 | Source:
195 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 | Classes
239 |
240 |
241 |
242 |
243 |
244 | Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 14:53:40 GMT-0400 (EDT)
245 |
246 |
247 |
248 |
249 |
250 |
--------------------------------------------------------------------------------
/js/helper.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @fileOverview Collection of helper functions.
3 | * @author Cynthia Teeters
4 | */
5 |
6 | /**
7 | * Configuration values shared between app.js and engine.js
8 | */
9 | var config = {
10 | canvasDimensions: {
11 | canvasWidth: 909,
12 | canvasHeight: 590,
13 | canvasRows: 6, // rows should stay at 6 unless changes made to engine.js
14 | canvasCols: 9
15 | },
16 | xDimensions: {
17 | xInterval: 101,
18 | xMax: 909
19 | },
20 | yDimensions: {
21 | yInterval: 83,
22 | yMax: 415
23 | },
24 | textStyles: {
25 | h3: '24pt Calibri',
26 | colored: "blue",
27 | h4: '18pt Calibri',
28 | black: "black",
29 | white: "#efeeea"
30 | }
31 | };
32 | var ctx, canvas, scaleVal = 1,
33 | canvasDiv, windowRect, isRunning = true,
34 | soundEfx, soundWin, sky, isScoreboardUp = false;
35 | //
36 |
37 | function createCanvas() {
38 |
39 | soundEfx = document.getElementById("soundEfx");
40 | soundEfx.volume = 1.0;
41 | soundWin = document.getElementById("soundWin");
42 | soundWin.volume = 0.1;
43 | sky = 'images/layer_2.png';
44 | Resources.load(sky);
45 |
46 | canvas = document.createElement('canvas');
47 | ctx = canvas.getContext('2d');
48 |
49 | canvasDiv = document.getElementById("canvas-here");
50 |
51 | /*
52 | * Create playarea
53 | */
54 |
55 | canvas.setAttribute("id", "playarea");
56 | //canvas.setAttribute("style", "border: 1px solid white");
57 |
58 | //
59 |
60 | // scale canvas to fit device
61 | scaleCanvas(ctx);
62 | var lazyResize = _.debounce(scaleCanvas, 300);
63 | $(window).resize(lazyResize);
64 | $("body").css("overflow", "hidden");
65 | //
66 | ctx.strokeRect(0, 0, config.canvasDimensions.canvasWidth, config.canvasDimensions.canvasHeight);
67 | ctx.fillStyle = "#566ed7";
68 | ctx.fillRect(0, 0, config.canvasDimensions.canvasWidth, 0.5 * config.canvasDimensions.canvasHeight);
69 | ctx.fillStyle = "#3f3f46";
70 | ctx.fillRect(0, 0.5 * config.canvasDimensions.canvasHeight, config.canvasDimensions.canvasWidth, 0.5 * config.canvasDimensions.canvasHeight);
71 | ctx.fillStyle = "#eee";
72 | ctx.fillRect(0, config.canvasDimensions.canvasHeight - 50, 0.25 * config.canvasDimensions.canvasWidth, 10);
73 | ctx.fillRect(0.25 * config.canvasDimensions.canvasWidth + 20, config.canvasDimensions.canvasHeight - 50, 0.25 * config.canvasDimensions.canvasWidth, 10);
74 | ctx.fillRect(0.5 * config.canvasDimensions.canvasWidth + 40, config.canvasDimensions.canvasHeight - 50, 0.25 * config.canvasDimensions.canvasWidth, 10);
75 | ctx.fillRect(0.75 * config.canvasDimensions.canvasWidth + 60, config.canvasDimensions.canvasHeight - 50, 0.25 * config.canvasDimensions.canvasWidth, 10);
76 |
77 | //
78 | canvas.width = scaleVal * config.canvasDimensions.canvasWidth;
79 | canvas.height = scaleVal * config.canvasDimensions.canvasHeight;
80 | //
81 |
82 | canvasDiv.appendChild(canvas);
83 |
84 | //
85 | ctx.scale(scaleVal, scaleVal);
86 |
87 | }
88 | //
89 | //
90 |
91 | function scaleCanvas() {
92 | var scaleX = window.innerWidth / (config.canvasDimensions.canvasWidth * 1.1);
93 | var scaleY = window.innerHeight / (config.canvasDimensions.canvasHeight * 1.1);
94 | scaleVal = (scaleX < scaleY) ? scaleX : scaleY;
95 |
96 | ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
97 | canvas.width = scaleVal * config.canvasDimensions.canvasWidth;
98 | canvas.height = scaleVal * config.canvasDimensions.canvasHeight;
99 | //
100 | canvasDiv.appendChild(canvas);
101 | windowRect = canvas.getBoundingClientRect();
102 | //
103 | ctx.scale(scaleVal, scaleVal);
104 | ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
105 | if (isScoreboardUp) {
106 | scoreboard.update(0);
107 | }
108 |
109 | }
110 |
111 | function createRandom(min, max) {
112 | //
113 | return Math.floor(Math.random() * (max - min + 1) + min);
114 | }
115 |
--------------------------------------------------------------------------------
/js/resources.js:
--------------------------------------------------------------------------------
1 | /* Resources.js
2 | * This is simply an image loading utility. It eases the process of loading
3 | * image files so that they can be used within your game. It also includes
4 | * a simple "caching" layer so it will reuse cached images if you attempt
5 | * to load the same image multiple times.
6 | */
7 | (function () {
8 | var resourceCache = {};
9 | var loading = [];
10 | var readyCallbacks = [];
11 |
12 | /* This is the publicly accessible image loading function. It accepts
13 | * an array of strings pointing to image files or a string for a single
14 | * image. It will then call our private image loading function accordingly.
15 | */
16 | function load(urlOrArr) {
17 | if (urlOrArr instanceof Array) {
18 | /* If the developer passed in an array of images
19 | * loop through each value and call our image
20 | * loader on that image file
21 | */
22 | urlOrArr.forEach(function (url) {
23 | _load(url);
24 | });
25 | } else {
26 | /* The developer did not pass an array to this function,
27 | * assume the value is a string and call our image loader
28 | * directly.
29 | */
30 | _load(urlOrArr);
31 | }
32 | }
33 |
34 | /* This is our private image loader function, it is
35 | * called by the public image loader function.
36 | */
37 | function _load(url) {
38 | if (resourceCache[url]) {
39 | // console.log("resource is loaded " , url); // CLT
40 | /* If this URL has been previously loaded it will exist within
41 | * our resourceCache array. Just return that image rather
42 | * re-loading the image.
43 | */
44 | return resourceCache[url];
45 | } else {
46 | /* This URL has not been previously loaded and is not present
47 | * within our cache; we'll need to load this image.
48 | */
49 | //console.log("resource is not loaded " , url); // CLT
50 | var img = new Image();
51 | img.onload = function () {
52 | /* Once our image has properly loaded, add it to our cache
53 | * so that we can simply return this image if the developer
54 | * attempts to load this file in the future.
55 | */
56 | resourceCache[url] = img;
57 |
58 | /* Once the image is actually loaded and properly cached,
59 | * call all of the onReady() callbacks we have defined.
60 | */
61 | if (isReady()) {
62 | readyCallbacks.forEach(function (func) {
63 | func();
64 | });
65 | }
66 | };
67 |
68 | /* Set the initial cache value to false, this will change when
69 | * the image's onload event handler is called. Finally, point
70 | * the images src attribute to the passed in URL.
71 | */
72 | resourceCache[url] = false;
73 | img.src = url;
74 | }
75 | }
76 |
77 | /* This is used by developer's to grab references to images they know
78 | * have been previously loaded. If an image is cached, this functions
79 | * the same as calling load() on that URL.
80 | */
81 | function get(url) {
82 | return resourceCache[url];
83 | }
84 |
85 | /* This function determines if all of the images that have been requested
86 | * for loading have in fact been completed loaded.
87 | */
88 | function isReady() {
89 | var ready = true;
90 | for (var k in resourceCache) {
91 | if (resourceCache.hasOwnProperty(k) &&
92 | !resourceCache[k]) {
93 | ready = false;
94 | }
95 | }
96 | return ready;
97 | }
98 |
99 | /* This function will add a function to the callback stack that is called
100 | * when all requested images are properly loaded.
101 | */
102 | function onReady(func) {
103 | readyCallbacks.push(func);
104 | }
105 |
106 | /* This object defines the publicly accessible functions available to
107 | * developers by creating a global Resources object.
108 | */
109 | window.Resources = {
110 | load: load,
111 | get: get,
112 | onReady: onReady,
113 | isReady: isReady
114 | };
115 | })();
116 |
--------------------------------------------------------------------------------
/jsDocFiles/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSDoc: Home
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Home
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | app.js
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
Arcade game similar to frogger.
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | Author:
94 |
95 |
98 |
99 |
100 |
101 |
102 | Copyright:
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 | Source:
112 |
115 |
116 |
117 |
118 |
119 |
120 | See:
121 |
122 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 | Classes
175 |
176 |
177 |
178 |
179 |
180 | Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 14:53:40 GMT-0400 (EDT)
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://classroom.github.com/online_ide?assignment_repo_id=2829407&assignment_repo_type=AssignmentRepo)
2 |
3 | # Classic Arcade Game Clone With Animation and Sound
4 |
5 | This is an arcade-style game utilizing Object Oriented JavaScript. The goal of the game is to get the hero across the field inhabited by crazy Evil Chomper Plants that are running amok. If our hero is bitten by an Evil Chomper Plant, the round is reset and you must try again. If our hero reaches the water, the score increases, and you get to go again.
6 |
7 | -Go Api
8 | ---
9 | 
10 | -Evil Chomper Plant
11 | ---
12 | 
13 | To play:
14 | ---
15 | - Left and Right arrow keys will make our hero run to the left or right.
16 | - Up arrow key makes our hero jump toward the river.
17 | - Down arrow key makes our hero jump back toward the sidewalk where the Evil Chomper Plants can't go.
18 | - Hitting the space key will toggle the game on and off.
19 | - If our hero is bit, she/he falls back to the starting position.
20 | - Our hero will get right back up with a nudge.
21 | - If our hero wins, we'll spend a few seconds dancing, and it's right back to the starting position.
22 | - Be patient of the well-deserved celebrating; you won't be able to move until it is over.
23 | - As the game proceeds, the Evil Chomper Plants may get angrier and speed up.
24 | - And, most important: super heros never die, so, go for really big scores!!
25 | - You can use a mouse or touch instead of the keys, but our hero only will move to an adjacent position. To play make sure you point only left, right, up, or down. No diagonals or big jumps, please.
26 |
27 | Browser Compatibility
28 | ---
29 | This game has been tested and appears to work well on these browsers on a Mac OSX Yosemite:
30 | * Google Chrome Version 45.0.2454.85
31 | * Firefox Version 40.0.3
32 | * Opera Version 31.0
33 | * Safari Version Version 8.0.8
34 |
35 | Device Compatibility
36 | ---
37 | In an effort to add device compatibility, this game was designed to be 1) responsive to screen size, 2) work with a mouse, and 3) be touch sensitive.
38 | - It has been tested on a Samsung Galaxy Tab 4 tablet and plays well. Using Google Chrome on the tablet allows you to save the game to your home page.
39 | - Unfortunately, it has also been tested on a Samsung Galaxy S6 and does not respond well enough to touch to be enjoyable.
40 | - iPhone and iPad emulation under Google Chrome Developer Tools, suggests that the game may play on these devices.
41 |
42 | Limitations
43 | ---
44 | - An attempt was made to create a mobile device app with [PhoneGap Build](https://build.phonegap.com/apps) but the resulting app is not touch responsive enough to be enjoybale.
45 | - It is likely that the configuration for the Hammer.js plugin (mouse and touch capabilities) needs to be tuned for better touch performance on small devices.
46 |
47 | Demo
48 | ---
49 | - You can see the demo at [I Got A Camera - Arcade Game ](http://igotacamera.com/arcade/).
50 |
51 | ## Installation
52 | - Clone the repository from [GitHub](http://GitHub.com/cynthiateeters/arcade-game) and unzip it into a directory accessible to your browser.
53 | - Open the index.html file in your browser and it should immediately allow you to play.
54 |
55 | ## Possible Later Enhancements
56 | - Add different styled enemies.
57 | - Add a splash screen.
58 | - Add support messages to the user when playing.
59 | - Give user the ability to choose a hero.
60 | - Add a truck that drives across on the road spilling fish.
61 | - Add fish dumped by the truck that then need to be saved and put in the water.
62 |
63 | ## License and Resources
64 | "Arcade Game" by Cynthia Teeters © 2015 can be used under [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/).
65 | - Images used to make the characters Evil Chompers were originally made by [Bevouliin - Imaginary Perception](http://bevouliin.com), and obtained from [OpenGameArt](http://opengameart.org) under a [CC0 public domain license](http://creativecommons.org/publicdomain/zero/1.0/).
66 | - Images to make litlle monkey were originally made by [fikri](http://graphicriver.net/user/fikri) and purchased under [Envato Standard License](http://graphicriver.net/licenses/standard?license=regular).
67 | - pacmanwakka.wav (created by remaxim) was obtained from [OpenGameArt](http://opengameart.org/content/pacman-clone-wakka-sound) under a [CC-BY-SA 3.0 license](http://creativecommons.org/licenses/by-sa/3.0/).
68 | - round_end.wac (created by sauer2) was obtained from [OpenGameArt](http://opengameart.org/content/oldschool-win-and-die-jump-and-run-soundscreated) under [CC0 license](http://creativecommons.org/publicdomain/zero/1.0/).
69 |
--------------------------------------------------------------------------------
/jsDocFiles/styles/jsdoc-default.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: normal;
4 | font-style: normal;
5 | src: url('../fonts/OpenSans-Regular-webfont.eot');
6 | src:
7 | local('Open Sans'),
8 | local('OpenSans'),
9 | url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
10 | url('../fonts/OpenSans-Regular-webfont.woff') format('woff'),
11 | url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
12 | }
13 |
14 | @font-face {
15 | font-family: 'Open Sans Light';
16 | font-weight: normal;
17 | font-style: normal;
18 | src: url('../fonts/OpenSans-Light-webfont.eot');
19 | src:
20 | local('Open Sans Light'),
21 | local('OpenSans Light'),
22 | url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
23 | url('../fonts/OpenSans-Light-webfont.woff') format('woff'),
24 | url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg');
25 | }
26 |
27 | html
28 | {
29 | overflow: auto;
30 | background-color: #fff;
31 | font-size: 14px;
32 | }
33 |
34 | body
35 | {
36 | font-family: 'Open Sans', sans-serif;
37 | line-height: 1.5;
38 | color: #4d4e53;
39 | background-color: white;
40 | }
41 |
42 | a, a:visited, a:active {
43 | color: #0095dd;
44 | text-decoration: none;
45 | }
46 |
47 | a:hover {
48 | text-decoration: underline;
49 | }
50 |
51 | header
52 | {
53 | display: block;
54 | padding: 0px 4px;
55 | }
56 |
57 | tt, code, kbd, samp {
58 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
59 | }
60 |
61 | .class-description {
62 | font-size: 130%;
63 | line-height: 140%;
64 | margin-bottom: 1em;
65 | margin-top: 1em;
66 | }
67 |
68 | .class-description:empty {
69 | margin: 0;
70 | }
71 |
72 | #main {
73 | float: left;
74 | width: 70%;
75 | }
76 |
77 | article dl {
78 | margin-bottom: 40px;
79 | }
80 |
81 | section
82 | {
83 | display: block;
84 | background-color: #fff;
85 | padding: 12px 24px;
86 | border-bottom: 1px solid #ccc;
87 | margin-right: 30px;
88 | }
89 |
90 | .variation {
91 | display: none;
92 | }
93 |
94 | .signature-attributes {
95 | font-size: 60%;
96 | color: #aaa;
97 | font-style: italic;
98 | font-weight: lighter;
99 | }
100 |
101 | nav
102 | {
103 | display: block;
104 | float: right;
105 | margin-top: 28px;
106 | width: 30%;
107 | box-sizing: border-box;
108 | border-left: 1px solid #ccc;
109 | padding-left: 16px;
110 | }
111 |
112 | nav ul {
113 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
114 | font-size: 100%;
115 | line-height: 17px;
116 | padding: 0;
117 | margin: 0;
118 | list-style-type: none;
119 | }
120 |
121 | nav ul a, nav ul a:visited, nav ul a:active {
122 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
123 | line-height: 18px;
124 | color: #4D4E53;
125 | }
126 |
127 | nav h3 {
128 | margin-top: 12px;
129 | }
130 |
131 | nav li {
132 | margin-top: 6px;
133 | }
134 |
135 | footer {
136 | display: block;
137 | padding: 6px;
138 | margin-top: 12px;
139 | font-style: italic;
140 | font-size: 90%;
141 | }
142 |
143 | h1, h2, h3, h4 {
144 | font-weight: 200;
145 | margin: 0;
146 | }
147 |
148 | h1
149 | {
150 | font-family: 'Open Sans Light', sans-serif;
151 | font-size: 48px;
152 | letter-spacing: -2px;
153 | margin: 12px 24px 20px;
154 | }
155 |
156 | h2, h3
157 | {
158 | font-size: 30px;
159 | font-weight: 700;
160 | letter-spacing: -1px;
161 | margin-bottom: 12px;
162 | }
163 |
164 | h4
165 | {
166 | font-size: 18px;
167 | letter-spacing: -0.33px;
168 | margin-bottom: 12px;
169 | color: #4d4e53;
170 | }
171 |
172 | h5, .container-overview .subsection-title
173 | {
174 | font-size: 120%;
175 | font-weight: bold;
176 | letter-spacing: -0.01em;
177 | margin: 8px 0 3px 0;
178 | }
179 |
180 | h6
181 | {
182 | font-size: 100%;
183 | letter-spacing: -0.01em;
184 | margin: 6px 0 3px 0;
185 | font-style: italic;
186 | }
187 |
188 | .ancestors { color: #999; }
189 | .ancestors a
190 | {
191 | color: #999 !important;
192 | text-decoration: none;
193 | }
194 |
195 | .clear
196 | {
197 | clear: both;
198 | }
199 |
200 | .important
201 | {
202 | font-weight: bold;
203 | color: #950B02;
204 | }
205 |
206 | .yes-def {
207 | text-indent: -1000px;
208 | }
209 |
210 | .type-signature {
211 | color: #aaa;
212 | }
213 |
214 | .name, .signature {
215 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
216 | }
217 |
218 | .details { margin-top: 14px; border-left: 2px solid #DDD; }
219 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; }
220 | .details dd { margin-left: 70px; }
221 | .details ul { margin: 0; }
222 | .details ul { list-style-type: none; }
223 | .details li { margin-left: 30px; padding-top: 6px; }
224 | .details pre.prettyprint { margin: 0 }
225 | .details .object-value { padding-top: 0; }
226 |
227 | .description {
228 | margin-bottom: 1em;
229 | margin-top: 1em;
230 | }
231 |
232 | .code-caption
233 | {
234 | font-style: italic;
235 | font-size: 107%;
236 | margin: 0;
237 | }
238 |
239 | .prettyprint
240 | {
241 | border: 1px solid #ddd;
242 | width: 80%;
243 | overflow: auto;
244 | }
245 |
246 | .prettyprint.source {
247 | width: inherit;
248 | }
249 |
250 | .prettyprint code
251 | {
252 | font-size: 100%;
253 | line-height: 18px;
254 | display: block;
255 | padding: 4px 12px;
256 | margin: 0;
257 | background-color: #fff;
258 | color: #4D4E53;
259 | }
260 |
261 | .prettyprint code span.line
262 | {
263 | display: inline-block;
264 | }
265 |
266 | .prettyprint.linenums
267 | {
268 | padding-left: 70px;
269 | -webkit-user-select: none;
270 | -moz-user-select: none;
271 | -ms-user-select: none;
272 | user-select: none;
273 | }
274 |
275 | .prettyprint.linenums ol
276 | {
277 | padding-left: 0;
278 | }
279 |
280 | .prettyprint.linenums li
281 | {
282 | border-left: 3px #ddd solid;
283 | }
284 |
285 | .prettyprint.linenums li.selected,
286 | .prettyprint.linenums li.selected *
287 | {
288 | background-color: lightyellow;
289 | }
290 |
291 | .prettyprint.linenums li *
292 | {
293 | -webkit-user-select: text;
294 | -moz-user-select: text;
295 | -ms-user-select: text;
296 | user-select: text;
297 | }
298 |
299 | .params, .props
300 | {
301 | border-spacing: 0;
302 | border: 0;
303 | border-collapse: collapse;
304 | }
305 |
306 | .params .name, .props .name, .name code {
307 | color: #4D4E53;
308 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
309 | font-size: 100%;
310 | }
311 |
312 | .params td, .params th, .props td, .props th
313 | {
314 | border: 1px solid #ddd;
315 | margin: 0px;
316 | text-align: left;
317 | vertical-align: top;
318 | padding: 4px 6px;
319 | display: table-cell;
320 | }
321 |
322 | .params thead tr, .props thead tr
323 | {
324 | background-color: #ddd;
325 | font-weight: bold;
326 | }
327 |
328 | .params .params thead tr, .props .props thead tr
329 | {
330 | background-color: #fff;
331 | font-weight: bold;
332 | }
333 |
334 | .params th, .props th { border-right: 1px solid #aaa; }
335 | .params thead .last, .props thead .last { border-right: 1px solid #ddd; }
336 |
337 | .params td.description > p:first-child,
338 | .props td.description > p:first-child
339 | {
340 | margin-top: 0;
341 | padding-top: 0;
342 | }
343 |
344 | .params td.description > p:last-child,
345 | .props td.description > p:last-child
346 | {
347 | margin-bottom: 0;
348 | padding-bottom: 0;
349 | }
350 |
351 | .disabled {
352 | color: #454545;
353 | }
354 |
--------------------------------------------------------------------------------
/images/bd-tools.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
10 |
12 |
45 |
49 |
52 |
73 |
78 |
79 |
--------------------------------------------------------------------------------
/js/engine.js:
--------------------------------------------------------------------------------
1 | /* Engine.js
2 | * This file provides the game loop functionality (update entities and render),
3 | * draws the initial game board on the screen, and then calls the update and
4 | * render methods on your player and enemy objects (defined in your app.js).
5 | *
6 | * A game engine works by drawing the entire game screen over and over, kind of
7 | * like a flipbook you may have created as a kid. When your player moves across
8 | * the screen, it may look like just that image/character is moving or being
9 | * drawn but that is not the case. What's really happening is the entire "scene"
10 | * is being drawn over and over, presenting the illusion of animation.
11 | *
12 | * This engine is available globally via the Engine variable and it also makes
13 | * the canvas' context (ctx) object globally available to make writing app.js
14 | * a little simpler to work with.
15 | */
16 |
17 | var Engine = (function (global) {
18 | /* Predefine the variables we'll be using within this scope,
19 | * create the canvas element, grab the 2D context for that canvas
20 | * set the canvas elements height/width and add it to the DOM.
21 | */
22 | var doc = global.document,
23 | win = global.window,
24 | lastTime;
25 | createCanvas();
26 |
27 | /* This function serves as the kickoff point for the game loop itself
28 | * and handles properly calling the update and render methods.
29 | */
30 | function main() {
31 | /* Get our time delta information which is required if your game
32 | * requires smooth animation. Because everyone's computer processes
33 | * instructions at different speeds we need a constant value that
34 | * would be the same for everyone (regardless of how fast their
35 | * computer is) - hurray time!
36 | */
37 | var now = Date.now(),
38 | dt = (now - lastTime) / 1000.0;
39 |
40 | /* Call our update/render functions, pass along the time delta to
41 | * our update function since it may be used for smooth animation.
42 | */
43 | //ctx.fillStyle = "#4e4e4e";
44 | //ctx.fillRect(0, 0, window.innerWidth, window.innerHeight);
45 | if (isRunning) {
46 | update(dt);
47 | render();
48 | }
49 |
50 | /* Set our lastTime variable which is used to determine the time delta
51 | * for the next time this function is called.
52 | */
53 | lastTime = now;
54 |
55 | /* Use the browser's requestAnimationFrame function to call this
56 | * function again as soon as the browser is able to draw another frame.
57 | */
58 | win.requestAnimationFrame(main);
59 | }
60 |
61 | /* This function does some initial setup that should only occur once,
62 | * particularly setting the lastTime variable that is required for the
63 | * game loop.
64 | */
65 | function init() {
66 | reset();
67 | lastTime = Date.now();
68 | scoreboard.update(0);
69 |
70 | main();
71 | }
72 |
73 | /* This function is called by main (our game loop) and itself calls all
74 | * of the functions which may need to update entity's data. Based on how
75 | * you implement your collision detection (when two entities occupy the
76 | * same space, for instance when your character should die), you may find
77 | * the need to add an additional function call here. For now, we've left
78 | * it commented out - you may or may not want to implement this
79 | * functionality this way (you could just implement collision detection
80 | * on the entities themselves within your app.js file).
81 | */
82 | function update(dt) {
83 | updateEntities(dt);
84 | // checkCollisions();
85 | }
86 |
87 | /* This is called by the update function and loops through all of the
88 | * objects within your allEnemies array as defined in app.js and calls
89 | * their update() methods. It will then call the update function for your
90 | * player object. These update methods should focus purely on updating
91 | * the data/properties related to the object. Do your drawing in your
92 | * render methods.
93 | */
94 | function updateEntities(dt) {
95 | allEnemies.forEach(function (enemy) {
96 | enemy.update(dt);
97 | });
98 | player.update();
99 | }
100 |
101 | /* This function initially draws the "game level", it will then call
102 | * the renderEntities function. Remember, this function is called every
103 | * game tick (or loop of the game engine) because that's how games work -
104 | * they are flipbooks creating the illusion of animation but in reality
105 | * they are just drawing the entire screen over and over.
106 | */
107 | function render() {
108 | /* This array holds the relative URL to the image used
109 | * for that particular row of the game level.
110 | */
111 | var rowImages = [
112 | 'images/water-block4.png', // Top row is water
113 | 'images/grass-block3.png', // Row 1 of 2 of grass
114 | 'images/grass-block4.png', // Row 2 of 2 of grass
115 | 'images/grass-block4.png', // Row 1 of 3 of grass
116 | 'images/grass-block4.png', // Row 2 of 3 of grass
117 | 'images/stone-block2.png' // Row 3 of 3 of stone
118 | ],
119 | numRows = config.canvasDimensions.canvasRows,
120 | numCols = config.canvasDimensions.canvasCols,
121 | row, col;
122 |
123 | /* Loop through the number of rows and columns we've defined above
124 | * and, using the rowImages array, draw the correct image for that
125 | * portion of the "grid"
126 | */
127 | for (row = 0; row < numRows; row++) {
128 | for (col = 0; col < numCols; col++) {
129 | /* The drawImage function of the canvas' context element
130 | * requires 3 parameters: the image to draw, the x coordinate
131 | * to start drawing and the y coordinate to start drawing.
132 | * We're using our Resources helpers to refer to our images
133 | * so that we get the benefits of caching these images, since
134 | * we're using them over and over.
135 | */
136 | ctx.drawImage(Resources.get(rowImages[row]), col * config.xDimensions.xInterval, row * config.yDimensions.yInterval);
137 | }
138 | }
139 | ctx.drawImage(Resources.get('images/flowers.png'), 0, 0);
140 | renderEntities();
141 | }
142 |
143 | /* This function is called by the render function and is called on each game
144 | * tick. It's purpose is to then call the render functions you have defined
145 | * on your enemy and player entities within app.js
146 | */
147 | function renderEntities() {
148 | /* Loop through all of the objects within the allEnemies array and call
149 | * the render function you have defined.
150 | */
151 | allEnemies.forEach(function (enemy) {
152 | enemy.render();
153 | });
154 |
155 | player.render();
156 |
157 | }
158 |
159 | /* This function does nothing but it could have been a good place to
160 | * handle game reset states - maybe a new game menu or a game over screen
161 | * those sorts of things. It's only called once by the init() method.
162 | */
163 | function reset() {
164 | // noop
165 | }
166 |
167 | /* Go ahead and load all of the images we know we're going to need to
168 | * draw our game level. Then set init as the callback method, so that when
169 | * all of these images are properly loaded our game will start.
170 | */
171 | Resources.load([
172 | 'images/stone-block2.png',
173 | 'images/water-block4.png',
174 | 'images/grass-block2.png',
175 | 'images/grass-block3.png',
176 | 'images/grass-block4.png',
177 | 'images/grass-block5.png',
178 | 'images/flowers.png'
179 | ]);
180 | Resources.onReady(init);
181 |
182 | /*
183 | * * Start touch control
184 | */
185 |
186 | var myArea = doc.getElementById("playarea");
187 |
188 | var mc = new Hammer(myArea);
189 | mc.on("tap", function (ev) {
190 | var move;
191 | // Find out where this canvas is on the page
192 | // See comments http://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/
193 | var tapX = (ev.center.x - windowRect.left) / scaleVal;
194 | var tapY = ((ev.center.y - windowRect.top) / scaleVal) - 50;
195 | var playerPos = player.report();
196 | //
197 | var deltaX = Math.abs(Math.floor((tapX - playerPos.xPos) / config.xDimensions.xInterval));
198 | var deltaY = Math.abs(Math.floor((tapY - playerPos.yPos) / config.yDimensions.yInterval));
199 | //
200 | if ((deltaX + deltaY) === 1) {
201 | if (deltaX === 1) {
202 | if (tapX > playerPos.xPos) {
203 | move = 'right';
204 | } else {
205 | move = 'left';
206 | }
207 | } else {
208 | if (tapY < playerPos.yPos) {
209 | move = 'up';
210 | } else {
211 | move = 'down';
212 | }
213 | }
214 | player.handleInput(move);
215 | }
216 | });
217 | })(this);
218 |
--------------------------------------------------------------------------------
/jsDocFiles/Player.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSDoc: Class: Player
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Class: Player
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Player
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
new Player()
46 |
47 |
48 |
49 |
50 |
51 |
52 | Represents a game hero.
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | Source:
95 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | Methods
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 | Logically move player along as user presses arrow keys.
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | Parameters:
164 |
165 |
166 |
167 |
168 |
169 |
170 | Name
171 |
172 |
173 | Type
174 |
175 |
176 |
177 |
178 |
179 | Description
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 | key
189 |
190 |
191 |
192 |
193 |
194 | string
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | user pressed this arrow key
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 | Source:
244 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 | render()
277 |
278 |
279 |
280 |
281 |
282 |
283 | Draw the player on the screen, a required method for game.
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 | Source:
326 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 | report() → {object}
359 |
360 |
361 |
362 |
363 |
364 |
365 | Allow player to share its position
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 | Source:
408 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 | Returns:
433 |
434 |
435 |
436 | - the player's (x,y) coordinates
437 |
438 |
439 |
440 |
441 |
442 |
443 | Type
444 |
445 |
446 |
447 | object
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 | reset(isHit)
463 |
464 |
465 |
466 |
467 |
468 |
469 | Reset the player back to his starting position.
470 | If it was hit, use image to show it as hurt.
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 | Parameters:
482 |
483 |
484 |
485 |
486 |
487 |
488 | Name
489 |
490 |
491 | Type
492 |
493 |
494 |
495 |
496 |
497 | Description
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 | isHit
507 |
508 |
509 |
510 |
511 |
512 | boolean
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 | -
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 | Source:
562 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 | update()
595 |
596 |
597 |
598 |
599 |
600 |
601 | Update the player's status.
602 | A win needs a celebration dance.
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 | Source:
645 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 | Classes
689 |
690 |
691 |
692 |
693 |
694 | Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 14:53:40 GMT-0400 (EDT)
695 |
696 |
697 |
698 |
699 |
700 |
--------------------------------------------------------------------------------
/jsDocFiles/Enemy.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSDoc: Class: Enemy
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Class: Enemy
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Enemy
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
new Enemy()
46 |
47 |
48 |
49 |
50 |
51 |
52 | Represents a game enemy, a thing the must hero.
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | Source:
95 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | Methods
139 |
140 |
141 |
142 |
143 |
144 |
145 | collision()
146 |
147 |
148 |
149 |
150 |
151 |
152 | Enemy checks if it has hit the hero. It has
153 | the ability to tell the player to reset.
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 | Source:
196 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 | init(col, row)
229 |
230 |
231 |
232 |
233 |
234 |
235 | Initialize pixel position of an enemy based on
236 | the game grid's column and row.
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 | Parameters:
248 |
249 |
250 |
251 |
252 |
253 |
254 | Name
255 |
256 |
257 | Type
258 |
259 |
260 |
261 |
262 |
263 | Description
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 | col
273 |
274 |
275 |
276 |
277 |
278 | number
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 | a gameboard grid column.
289 |
290 |
291 |
292 |
293 |
294 |
295 | row
296 |
297 |
298 |
299 |
300 |
301 | number
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 | a gameboard grid column.
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 | Source:
351 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 | render()
384 |
385 |
386 |
387 |
388 |
389 |
390 | Draw the enemy on the screen, a required method for game.
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 | Source:
433 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 | report() → {object}
466 |
467 |
468 |
469 |
470 |
471 |
472 | Allow enemy to share its position
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 | Source:
515 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 | Returns:
540 |
541 |
542 |
543 | the enemy's (x,y) coordinates
544 |
545 |
546 |
547 |
548 |
549 |
550 | Type
551 |
552 |
553 |
554 | object
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 | update(dt)
570 |
571 |
572 |
573 |
574 |
575 |
576 | Update the enemy's position, a required method for the game
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 | Parameters:
588 |
589 |
590 |
591 |
592 |
593 |
594 | Name
595 |
596 |
597 | Type
598 |
599 |
600 |
601 |
602 |
603 | Description
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 | dt
613 |
614 |
615 |
616 |
617 |
618 | number
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 | a time delta between ticks.
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 | Source:
668 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 | Classes
712 |
713 |
714 |
715 |
716 |
717 | Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 14:53:40 GMT-0400 (EDT)
718 |
719 |
720 |
721 |
722 |
723 |
--------------------------------------------------------------------------------
/jsDocFiles/scripts/prettify/Apache-License-2.0.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/js/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file Arcade game similar to frogger.
3 | * @author Cynthia Teeters
4 | * @copyright Cynthia Teeters © 2015
5 | *
6 | *
7 | * @see Images used to make this game's characters Evil Chompers
8 | * were originally made [Bevouliin - Imaginary Perception]{@link http://bevouliin.com} ,
9 | * and obtained from [OpenGameArt]{@link opengameart.org} under [CC0 license]{@link http://creativecommons.org/publicdomain/zero/1.0/}.
10 | *
11 | * @see Images to make litlle monkey were originally made by [fikri]{@link http://graphicriver.net/user/fikri} and
12 | * purchased under [Envato Standard License]{@link http://graphicriver.net/licenses/standard?license=regular}.
13 | *
14 | * @see pacmanwakka.wav (created by remaxim) was obtained from [OpenGameArt]{@link http://opengameart.org/content/pacman-clone-wakka-sound}
15 | * under a [CC-BY-SA 3.0 license]{@link http://creativecommons.org/licenses/by-sa/3.0/}.
16 | *
17 | * @see round_end.wac (created by sauer2) was obtained from [OpenGameArt]{@link http://opengameart.org/content/oldschool-win-and-die-jump-and-run-soundscreated}
18 | * under [CC0 license]{@link http://creativecommons.org/publicdomain/zero/1.0/}.
19 | */
20 |
21 | /**
22 | * Represents a game enemy, a thing the must hero.
23 | * @constructor
24 | */
25 | var Enemy = function () {
26 | /*
27 | There are two images for each enemy to make it
28 | animated by chomping its teeth.
29 | */
30 | this.enemyArr = ['images/evil-red-flower-2.png',
31 | 'images/evil-red-flower-1.png'
32 | ];
33 | Resources.load(this.enemyArr);
34 | this.sprite = this.enemyArr[0];
35 | /*
36 | * Basic game physics: speed and acceleration
37 | */
38 | this.x = -101;
39 | this.y = -200;
40 | this.maxSpeed = createRandom(300, 400);
41 | this.speed = createRandom(60, 140);
42 | this.startSpeed = this.speed;
43 | this.accel = createRandom(10001, 10005) / 10000;
44 | this.speeding = false;
45 | this.timeSpeeding = 0;
46 | /*
47 | * Make enemy randomly chomp its teeth
48 | */
49 | this.chomp = createRandom(0, 1); // used to load chomp sprite, must toggle between 0 and 1
50 | this.chompSpeed = createRandom(4, 33);
51 | this.chompCount = 0;
52 | };
53 |
54 | /**
55 | * Initialize pixel position of an enemy based on
56 | * the game grid's column and row.
57 | *
58 | * @param {number} col - a gameboard grid column.
59 | * @param {number} row - a gameboard grid column.
60 | */
61 | Enemy.prototype.init = function (col, row) {
62 | this.x = config.xDimensions.xInterval * col;
63 | this.y = config.yDimensions.yInterval * row;
64 | };
65 |
66 | /**
67 | * Update the enemy's position, a required method for the game
68 | *
69 | * @param {number} dt - a time delta between ticks.
70 | *
71 | */
72 | Enemy.prototype.update = function (dt) {
73 | // Multiply any movement by the dt parameter
74 | // which will ensure the game runs at the same speed for
75 | // all computers.
76 |
77 | // Animate enemy's mouth
78 | this.chompCount++;
79 | if (this.chompCount % this.chompSpeed === 0) {
80 | this.chomp = 1 - this.chomp;
81 | this.sprite = this.enemyArr[this.chomp];
82 | }
83 |
84 | // Check for a possible collision with hero
85 | this.collision();
86 |
87 | // Game physics
88 | if (this.speed < this.maxSpeed) {
89 | this.speed = this.speed * this.accel;
90 | } else {
91 | if (!this.speeding) {
92 | this.speeding = true;
93 | }
94 | }
95 | var newX = this.x + this.speed * dt;
96 | if (newX > config.xDimensions.xMax) {
97 | this.x = -202;
98 | this.chompSpeed = createRandom(2, 33);
99 | if (this.speeding) {
100 | this.timeSpeeding += 1;
101 | if (this.timeSpeeding > 6) {
102 | this.speed = this.startSpeed;
103 | this.speeding = false;
104 | this.timeSpeeding = 0;
105 | var change = -1 + Math.round(Math.random()) * 2;
106 | this.maxSpeed = this.maxSpeed + change * 150 * Math.random();
107 | this.accel = createRandom(10001, 10005) / 10000;
108 | }
109 | }
110 | } else {
111 | this.x = newX;
112 | }
113 | };
114 |
115 | /**
116 | * Allow enemy to share its position
117 | * @returns {object} the enemy's (x,y) coordinates
118 | */
119 | Enemy.prototype.report = function () {
120 | return {
121 | xPos: this.x,
122 | yPos: this.y
123 | };
124 | };
125 |
126 | /**
127 | * Enemy checks if it has hit the hero. It has
128 | * the ability to tell the player to reset.
129 | */
130 | Enemy.prototype.collision = function () {
131 | var playerPos = player.report();
132 | var diffX = Math.abs(this.x - playerPos.xPos);
133 | var diffY = Math.abs(this.y - playerPos.yPos);
134 |
135 | if (diffX < (config.xDimensions.xInterval - 40) && diffY < config.yDimensions.yInterval) {
136 | player.reset(true);
137 | soundEfx.play();
138 | }
139 | };
140 |
141 | /**
142 | * Draw the enemy on the screen, a required method for game.
143 | */
144 | Enemy.prototype.render = function () {
145 | ctx.drawImage(Resources.get(this.sprite), this.x, this.y);
146 | };
147 |
148 | /**
149 | * Represents a game hero.
150 | * @constructor
151 | */
152 | var Player = function () {
153 | this.enemyArr = [
154 | 'images/wu-idle.png',
155 | 'images/wu-rr.png',
156 | 'images/wu-rl.png',
157 | 'images/wu-up.png',
158 | 'images/wu-down.png',
159 | 'images/wu-hit2.png',
160 | 'images/wu-joy-r.png',
161 | 'images/wu-joy-l.png'
162 | ];
163 | Resources.load(this.enemyArr);
164 | this.sprite = this.enemyArr[0];
165 | this.x = Math.floor((config.canvasDimensions.canvasCols - 1) / 2) * config.xDimensions.xInterval;
166 | this.y = 5 * config.yDimensions.yInterval;
167 | this.startX = this.x;
168 | this.startY = this.y;
169 | this.victory = 0;
170 | this.victoryCelebration = false;
171 | this.victoryCount = 0;
172 |
173 | };
174 |
175 | /**
176 | * Draw the player on the screen, a required method for game.
177 | */
178 | Player.prototype.render = function () {
179 | ctx.drawImage(Resources.get(this.sprite), this.x, this.y);
180 | };
181 |
182 | /**
183 | * Update the player's status.
184 | * A win needs a celebration dance.
185 | */
186 | Player.prototype.update = function () {
187 | // If player wins, have it jump for joy
188 | // and let that jumping go for 75 loop cycles,
189 | // then update score, and reset back to start pos.
190 | if (this.y === 0 && this.victoryCount < 75) {
191 | soundWin.play();
192 | this.victoryCelebration = true;
193 | this.victoryCount++;
194 | if (this.victoryCount % 14 === 0) {
195 | // toggle between up and down jump enemyArr
196 | this.victory = 1 - this.victory;
197 | this.sprite = this.enemyArr[this.victory + 6];
198 | }
199 | if (this.victoryCount >= 75) {
200 | player.reset(false);
201 | this.victoryCount = 0;
202 | this.victoryCelebration = false;
203 | scoreboard.update(1);
204 | }
205 | }
206 | };
207 |
208 | /**
209 | * Allow player to share its position
210 | * @returns {object} - the player's (x,y) coordinates
211 | */
212 | Player.prototype.report = function () {
213 | return {
214 | xPos: this.x,
215 | yPos: this.y
216 | };
217 | };
218 |
219 | /**
220 | * Reset the player back to his starting position.
221 | * If it was hit, use image to show it as hurt.
222 | *
223 | * @param {boolean} isHit -
224 | */
225 | Player.prototype.reset = function (isHit) {
226 | if (isHit) {
227 | this.sprite = this.enemyArr[5];
228 | } else {
229 | this.sprite = this.enemyArr[0];
230 | }
231 | this.x = this.startX;
232 | this.y = this.startY;
233 | };
234 |
235 | /**
236 | * Logically move player along as user presses arrow keys.
237 | *
238 | * @param {string} key - user pressed this arrow key
239 | */
240 | Player.prototype.handleInput = function (key) {
241 | if (this.victoryCelebration) {
242 | return;
243 | }
244 |
245 | if (key == 'space') {
246 | isRunning = !isRunning;
247 | }
248 | if (isRunning) {
249 | if (key == 'up') {
250 | if (this.y > config.yDimensions.yInterval) {
251 | this.y -= config.yDimensions.yInterval;
252 | this.sprite = this.enemyArr[3];
253 | } else {
254 | this.y = 0;
255 | }
256 | } else if (key == 'down' && (this.y < config.yDimensions.yMax)) {
257 | this.y += config.yDimensions.yInterval;
258 | this.sprite = this.enemyArr[4];
259 | } else if (key == 'right' && (this.x < config.xDimensions.xMax - config.xDimensions.xInterval)) {
260 | this.x += config.xDimensions.xInterval;
261 | this.sprite = this.enemyArr[1];
262 | } else if (key == 'left') {
263 | if (this.x > config.xDimensions.xInterval) {
264 | this.x -= config.xDimensions.xInterval;
265 | this.sprite = this.enemyArr[2];
266 | } else {
267 | this.x = 0;
268 | }
269 | }
270 | if (this.x == this.startX && this.y == this.startY) {
271 | this.sprite = this.enemyArr[0];
272 | }
273 | }
274 | };
275 |
276 | /**
277 | * Represents the game's scoreboard.
278 | * @constructor
279 | */
280 | var Scoreboard = function () {
281 | this.numberWins = 0;
282 | };
283 |
284 | /**
285 | * Update the player's score.
286 | */
287 | Scoreboard.prototype.update = function (wins) {
288 |
289 | isScoreboardUp = true;
290 | if (typeof wins === 'number') {
291 | this.numberWins += wins;
292 | ctx.drawImage(Resources.get(sky), 0, 0);
293 | var winText = 'Your Score: ' + this.numberWins;
294 | //ctx.clearRect(0, 0, canvas.width, canvas.height);
295 | //ctx.fillStyle = "#4e4e4e";
296 | //ctx.clearRect(0, 0, canvas.width, canvas.height);
297 | ctx.font = config.textStyles.h3;
298 | ctx.fillStyle = config.textStyles.black;
299 | ctx.fillStyle = "#4e4e4e";
300 | ctx.fillText(winText, 65, 44);
301 |
302 | }
303 |
304 | };
305 |
306 | // Now instantiate objects.
307 | // Place all enemy objects in an array called allEnemies
308 | var allEnemies = [];
309 | var i;
310 | //Make an enemy - one on each of the grass rows
311 | for (i = 0; i < 4; i++) {
312 | allEnemies.push(new Enemy());
313 | allEnemies[i].init(createRandom(-2, 5), i + 1);
314 | }
315 | //Make some more enemies that are more randomly placed
316 | var max = createRandom(5, 8);
317 | for (i; i < max; i++) {
318 | allEnemies.push(new Enemy());
319 | allEnemies[i].init(createRandom(-2, config.canvasDimensions.canvasCols), createRandom(1, 4));
320 | }
321 |
322 | // Place the player object in a variable called player
323 | var player = new Player(); // CLT
324 |
325 | // Place the scoreboard object in a variable called scoreboard
326 | var scoreboard = new Scoreboard();
327 |
328 | // This listens for key presses and sends the keys to your
329 | // Player.handleInput() method. You don't need to modify this.
330 | document.addEventListener('keyup', function (e) {
331 | var allowedKeys = {
332 | 37: 'left',
333 | 38: 'up',
334 | 39: 'right',
335 | 40: 'down',
336 | 32: 'space'
337 | };
338 | player.handleInput(allowedKeys[e.keyCode]);
339 | });
340 |
--------------------------------------------------------------------------------
/jsDocFiles/scripts/prettify/prettify.js:
--------------------------------------------------------------------------------
1 | var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
2 | (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
3 | [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
9 | l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
10 | q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
11 | q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
12 | "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
13 | a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
14 | for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
19 | H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
20 | J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
21 | I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Source: app.js
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | /**
30 | * @file Arcade game similar to frogger.
31 | * @author Cynthia Teeters <me@cynthiateeters.com>
32 | * @copyright Cynthia Teeters © 2015
33 | *
34 | *
35 | * @see Images used to make this game's characters Evil Chompers
36 | * were originally made [Bevouliin - Imaginary Perception]{@link http://bevouliin.com} ,
37 | * and obtained from [OpenGameArt]{@link opengameart.org} under [CC0 license]{@link http://creativecommons.org/publicdomain/zero/1.0/}.
38 | *
39 | * @see Images to make litlle monkey were originally made by [fikri]{@link http://graphicriver.net/user/fikri} and
40 | * purchased under [Envato Standard License]{@link http://graphicriver.net/licenses/standard?license=regular}.
41 | *
42 | * @see pacmanwakka.wav (created by remaxim) was obtained from [OpenGameArt]{@link http://opengameart.org/content/pacman-clone-wakka-sound}
43 | * under a [CC-BY-SA 3.0 license]{@link http://creativecommons.org/licenses/by-sa/3.0/}.
44 | *
45 | * @see round_end.wac (created by sauer2) was obtained from [OpenGameArt]{@link http://opengameart.org/content/oldschool-win-and-die-jump-and-run-soundscreated}
46 | * under [CC0 license]{@link http://creativecommons.org/publicdomain/zero/1.0/}.
47 | */
48 |
49 | /**
50 | * Represents a game enemy, a thing the must hero.
51 | * @constructor
52 | */
53 | var Enemy = function () {
54 | /*
55 | There are two images for each enemy to make it
56 | animated by chomping its teeth.
57 | */
58 | this.enemyArr = ['images/evil-red-flower-2.png',
59 | 'images/evil-red-flower-1.png'
60 | ];
61 | Resources.load(this.enemyArr);
62 | this.sprite = this.enemyArr[0];
63 | /*
64 | * Basic game physics: speed and acceleration
65 | */
66 | this.x = -101;
67 | this.y = -200;
68 | this.maxSpeed = createRandom(300, 400);
69 | this.speed = createRandom(60, 140);
70 | this.startSpeed = this.speed;
71 | this.accel = createRandom(10001, 10005) / 10000;
72 | this.speeding = false;
73 | this.timeSpeeding = 0;
74 | /*
75 | * Make enemy randomly chomp its teeth
76 | */
77 | this.chomp = createRandom(0, 1); // used to load chomp sprite, must toggle between 0 and 1
78 | this.chompSpeed = createRandom(4, 33);
79 | this.chompCount = 0;
80 | };
81 |
82 | /**
83 | * Initialize pixel position of an enemy based on
84 | * the game grid's column and row.
85 | *
86 | * @param {number} col - a gameboard grid column.
87 | * @param {number} row - a gameboard grid column.
88 | */
89 | Enemy.prototype.init = function (col, row) {
90 | this.x = config.xDimensions.xInterval * col;
91 | this.y = config.yDimensions.yInterval * row;
92 | };
93 |
94 | /**
95 | * Update the enemy's position, a required method for the game
96 | *
97 | * @param {number} dt - a time delta between ticks.
98 | *
99 | */
100 | Enemy.prototype.update = function (dt) {
101 | // Multiply any movement by the dt parameter
102 | // which will ensure the game runs at the same speed for
103 | // all computers.
104 |
105 | // Animate enemy's mouth
106 | this.chompCount++;
107 | if (this.chompCount % this.chompSpeed === 0) {
108 | this.chomp = 1 - this.chomp;
109 | this.sprite = this.enemyArr[this.chomp];
110 | }
111 |
112 | // Check for a possible collision with hero
113 | this.collision();
114 |
115 | // Game physics
116 | if (this.speed < this.maxSpeed) {
117 | this.speed = this.speed * this.accel;
118 | } else {
119 | if (!this.speeding) {
120 | this.speeding = true;
121 | }
122 | }
123 | var newX = this.x + this.speed * dt;
124 | if (newX > config.xDimensions.xMax) {
125 | this.x = -202;
126 | this.chompSpeed = createRandom(2, 33);
127 | if (this.speeding) {
128 | this.timeSpeeding += 1;
129 | if (this.timeSpeeding > 6) {
130 | this.speed = this.startSpeed;
131 | this.speeding = false;
132 | this.timeSpeeding = 0;
133 | var change = -1 + Math.round(Math.random()) * 2;
134 | this.maxSpeed = this.maxSpeed + change * 150 * Math.random();
135 | this.accel = createRandom(10001, 10005) / 10000;
136 | }
137 | }
138 | } else {
139 | this.x = newX;
140 | }
141 | };
142 |
143 | /**
144 | * Allow enemy to share its position
145 | * @returns {object} the enemy's (x,y) coordinates
146 | */
147 | Enemy.prototype.report = function () {
148 | return {
149 | xPos: this.x,
150 | yPos: this.y
151 | };
152 | };
153 |
154 | /**
155 | * Enemy checks if it has hit the hero. It has
156 | * the ability to tell the player to reset.
157 | */
158 | Enemy.prototype.collision = function () {
159 | var playerPos = player.report();
160 | var diffX = Math.abs(this.x - playerPos.xPos);
161 | var diffY = Math.abs(this.y - playerPos.yPos);
162 |
163 | if (diffX < (config.xDimensions.xInterval - 40) && diffY < config.yDimensions.yInterval) {
164 | player.reset(true);
165 | soundEfx.play();
166 | }
167 | };
168 |
169 | /**
170 | * Draw the enemy on the screen, a required method for game.
171 | */
172 | Enemy.prototype.render = function () {
173 | ctx.drawImage(Resources.get(this.sprite), this.x, this.y);
174 | };
175 |
176 | /**
177 | * Represents a game hero.
178 | * @constructor
179 | */
180 | var Player = function () {
181 | this.enemyArr = [
182 | 'images/wu-idle.png',
183 | 'images/wu-rr.png',
184 | 'images/wu-rl.png',
185 | 'images/wu-up.png',
186 | 'images/wu-down.png',
187 | 'images/wu-hit2.png',
188 | 'images/wu-joy-r.png',
189 | 'images/wu-joy-l.png'
190 | ];
191 | Resources.load(this.enemyArr);
192 | this.sprite = this.enemyArr[0];
193 | this.x = Math.floor((config.canvasDimensions.canvasCols - 1) / 2) * config.xDimensions.xInterval;
194 | this.y = 5 * config.yDimensions.yInterval;
195 | this.startX = this.x;
196 | this.startY = this.y;
197 | this.victory = 0;
198 | this.victoryCelebration = false;
199 | this.victoryCount = 0;
200 |
201 | };
202 |
203 | /**
204 | * Draw the player on the screen, a required method for game.
205 | */
206 | Player.prototype.render = function () {
207 | ctx.drawImage(Resources.get(this.sprite), this.x, this.y);
208 | };
209 |
210 | /**
211 | * Update the player's status.
212 | * A win needs a celebration dance.
213 | */
214 | Player.prototype.update = function () {
215 | // If player wins, have it jump for joy
216 | // and let that jumping go for 75 loop cycles,
217 | // then update score, and reset back to start pos.
218 | if (this.y === 0 && this.victoryCount < 75) {
219 | soundWin.play();
220 | this.victoryCelebration = true;
221 | this.victoryCount++;
222 | if (this.victoryCount % 14 === 0) {
223 | // toggle between up and down jump enemyArr
224 | this.victory = 1 - this.victory;
225 | this.sprite = this.enemyArr[this.victory + 6];
226 | }
227 | if (this.victoryCount >= 75) {
228 | player.reset(false);
229 | this.victoryCount = 0;
230 | this.victoryCelebration = false;
231 | scoreboard.update(1);
232 | }
233 | }
234 | };
235 |
236 | /**
237 | * Allow player to share its position
238 | * @returns {object} - the player's (x,y) coordinates
239 | */
240 | Player.prototype.report = function () {
241 | return {
242 | xPos: this.x,
243 | yPos: this.y
244 | };
245 | };
246 |
247 | /**
248 | * Reset the player back to his starting position.
249 | * If it was hit, use image to show it as hurt.
250 | *
251 | * @param {boolean} isHit -
252 | */
253 | Player.prototype.reset = function (isHit) {
254 | if (isHit) {
255 | this.sprite = this.enemyArr[5];
256 | } else {
257 | this.sprite = this.enemyArr[0];
258 | }
259 | this.x = this.startX;
260 | this.y = this.startY;
261 | };
262 |
263 | /**
264 | * Logically move player along as user presses arrow keys.
265 | *
266 | * @param {string} key - user pressed this arrow key
267 | */
268 | Player.prototype.handleInput = function (key) {
269 | if (this.victoryCelebration) {
270 | return;
271 | }
272 |
273 | if (key == 'space') {
274 | isRunning = !isRunning;
275 | }
276 | if (isRunning) {
277 | if (key == 'up') {
278 | if (this.y > config.yDimensions.yInterval) {
279 | this.y -= config.yDimensions.yInterval;
280 | this.sprite = this.enemyArr[3];
281 | } else {
282 | this.y = 0;
283 | }
284 | } else if (key == 'down' && (this.y < config.yDimensions.yMax)) {
285 | this.y += config.yDimensions.yInterval;
286 | this.sprite = this.enemyArr[4];
287 | } else if (key == 'right' && (this.x < config.xDimensions.xMax - config.xDimensions.xInterval)) {
288 | this.x += config.xDimensions.xInterval;
289 | this.sprite = this.enemyArr[1];
290 | } else if (key == 'left') {
291 | if (this.x > config.xDimensions.xInterval) {
292 | this.x -= config.xDimensions.xInterval;
293 | this.sprite = this.enemyArr[2];
294 | } else {
295 | this.x = 0;
296 | }
297 | }
298 | if (this.x == this.startX && this.y == this.startY) {
299 | this.sprite = this.enemyArr[0];
300 | }
301 | }
302 | };
303 |
304 | /**
305 | * Represents the game's scoreboard.
306 | * @constructor
307 | */
308 | var Scoreboard = function () {
309 | this.numberWins = 0;
310 | };
311 |
312 | /**
313 | * Update the player's score.
314 | */
315 | Scoreboard.prototype.update = function (wins) {
316 |
317 | isScoreboardUp = true;
318 | if (typeof wins === 'number') {
319 | this.numberWins += wins;
320 | ctx.drawImage(Resources.get(sky), 0, 0);
321 | var winText = 'Your Score: ' + this.numberWins;
322 | //ctx.clearRect(0, 0, canvas.width, canvas.height);
323 | //ctx.fillStyle = "#4e4e4e";
324 | //ctx.clearRect(0, 0, canvas.width, canvas.height);
325 | ctx.font = config.textStyles.h3;
326 | ctx.fillStyle = config.textStyles.black;
327 | ctx.fillStyle = "#4e4e4e";
328 | ctx.fillText(winText, 65, 44);
329 |
330 | }
331 |
332 | };
333 |
334 | // Now instantiate objects.
335 | // Place all enemy objects in an array called allEnemies
336 | var allEnemies = [];
337 | var i;
338 | //Make an enemy - one on each of the grass rows
339 | for (i = 0; i < 4; i++) {
340 | allEnemies.push(new Enemy());
341 | allEnemies[i].init(createRandom(-2, 5), i + 1);
342 | }
343 | //Make some more enemies that are more randomly placed
344 | var max = createRandom(5, 8);
345 | for (i; i < max; i++) {
346 | allEnemies.push(new Enemy());
347 | allEnemies[i].init(createRandom(-2, config.canvasDimensions.canvasCols), createRandom(1, 4));
348 | }
349 |
350 | // Place the player object in a variable called player
351 | var player = new Player(); // CLT
352 |
353 | // Place the scoreboard object in a variable called scoreboard
354 | var scoreboard = new Scoreboard();
355 |
356 | // This listens for key presses and sends the keys to your
357 | // Player.handleInput() method. You don't need to modify this.
358 | document.addEventListener('keyup', function (e) {
359 | var allowedKeys = {
360 | 37: 'left',
361 | 38: 'up',
362 | 39: 'right',
363 | 40: 'down',
364 | 32: 'space'
365 | };
366 | player.handleInput(allowedKeys[e.keyCode]);
367 | });
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 | Classes
379 |
380 |
381 |
382 |
383 |
384 | Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 14:53:40 GMT-0400 (EDT)
385 |
386 |
387 |
388 |
389 |
390 |