Skip to content

Commit ffe2153

Browse files
committed
Merge pull request #14 from MattSurabian/pixi
PixiJS Refactor
2 parents af24f38 + 76d705a commit ffe2153

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+51817
-12915
lines changed

.jscsrc

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"esnext": true,
3+
"disallowMixedSpacesAndTabs": true,
4+
"disallowSpaceAfterObjectKeys": true,
5+
"disallowSpaceBeforeBinaryOperators": [
6+
","
7+
],
8+
"disallowSpacesInFunctionExpression": {
9+
"beforeOpeningRoundBrace": true
10+
},
11+
"disallowSpacesInsideArrayBrackets": true,
12+
"disallowSpacesInsideParentheses": true,
13+
"disallowTrailingWhitespace": true,
14+
"maximumLineLength": 150,
15+
"requireCommaBeforeLineBreak": true,
16+
"requireLineFeedAtFileEnd": true,
17+
"requireSpaceAfterBinaryOperators": [
18+
"=",
19+
",",
20+
"+",
21+
"-",
22+
"/",
23+
"*",
24+
"==",
25+
"===",
26+
"!=",
27+
"!==",
28+
":",
29+
"&&",
30+
"||"
31+
],
32+
"requireSpaceAfterKeywords": [
33+
"if",
34+
"else",
35+
"for",
36+
"while",
37+
"do",
38+
"switch",
39+
"return",
40+
"try",
41+
"catch"
42+
],
43+
"requireSpaceBeforeBinaryOperators": [
44+
"=",
45+
"+",
46+
"-",
47+
"/",
48+
"*",
49+
"==",
50+
"===",
51+
"!=",
52+
"!==",
53+
"&&",
54+
"||"
55+
],
56+
"requireSpaceBeforeBlockStatements": true,
57+
"requireSpacesInFunctionExpression": {
58+
"beforeOpeningCurlyBrace": true
59+
},
60+
"safeContextKeyword": ["_this"],
61+
"validateQuoteMarks": {
62+
"escape": true,
63+
"mark": "'"
64+
}
65+
}

.jshintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"esnext": true
3+
}

README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
1-
# DUCK HUNT JS v2.0
1+
# DUCK HUNT JS v3.0
22

3-
[Play the game](http://mattsurabian.com/duckhunt)
3+
[Play the game](http://duckhuntjs.com)
44

5-
This is an implementation of DuckHunt in javascript using HTML5 audio.
5+
This is an implementation of DuckHunt in Javascript and HTML5. It uses the PixiJS rendering engine, Green Sock Animations, Howler, and Bluebird Promises.
66

7-
All of the game logic is in the duckhunt directory. This project uses [gulp](http://gulpjs.com/) to build two concatenated js files;
8-
one representing all of our game logic the other representing necessary javascript library dependencies.
7+
## Rendering
8+
This game supports WebGL and Canvas rendering via the PixiJS rendering engine.
99

10-
This refactor of the game relies on custom events to control game flow which has cut down a bit on the "animation callback hell"
11-
faced in version 1.
10+
## Audio
11+
This game will attempt to use the WebAudioAPI and fallback to HTML5 Audio if necessary. Audio is loaded and controlled via HowlerJS.
12+
13+
## Tweening
14+
The animations in this game are a combination of PixiJS MovieClips built from sprite images and tweens. Since PixiJS doesn't provide a tweening API, Green Sock was used.
15+
16+
## Game Logic
17+
The flow of this game is managed using Javascript. The main chunks of business logic are implemented as ES6 classes which are transpiled to ES5 using Babel.
1218

1319
## Working With This Repo
1420

15-
1. Clone the repo into a directory of your choice
16-
1. `cd` into that directory and run `npm install`
17-
1. Use the `gulp dev` task during active development. This task automatically builds all necessary JS files and triggers the [livereload browser extension](http://livereload.com/extensions/) to do its thing and reload the page when changes are detected in the `lib` and `duckhunt` directories.
18-
1. If you want to manually cut a build of the JS the default gulp task will lint, concatenate, and minify the project's javascript files it into the build directory.
21+
- You must have [nodejs](https://nodejs.org/) installed. This project also uses `gulp`. Installing it globally with `npm install -g gulp` is optional, though if you choose not to install it globally you'll have to use `npm run gulp -- TASK` instead of just `gulp TASK` when following the rest of this README.
22+
- Clone the repo into a directory of your choice
23+
- `cd` into that directory and run `npm install`
24+
- Use `gulp serve` to start a local webserver which will make the site available at http://localhost:8080/. Cross origin errors prevent this project from being accessed in the browser with the `file://` protocol.
25+
- If you're interested in modifying the code, use the `gulp dev` task to serve the site on http://localhost:8080/ and trigger automatic builds and reloads of the page when changes are detected in the `src` directory.
26+
- If you want to manually cut a build of the JS, the default gulp task will run jshint, ensure code style compliance via JSCS, transpile to ES5 and browserify everything into a single `duckhunt.js` file in the `dist` folder. The default task also constructs new image and audio sprite sheets and their respecitve manifests.
27+
28+
## Bugs
29+
Please report bugs as [issues](https://github.com/MattSurabian/DuckHunt-JS/issues).
30+
31+
## Contributing
32+
Pull requests are welcome! Please ensure `jscs` and `jshint` compliance and include any built files.

build/duckhunt.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/libs.min.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

dist/audio.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"urls": [
3+
"audio.ogg",
4+
"audio.mp3"
5+
],
6+
"sprite": {
7+
"barkDucks": [
8+
0,
9+
2403.265306122449
10+
],
11+
"champ": [
12+
4000,
13+
9639.183673469388
14+
],
15+
"gunSound": [
16+
15000,
17+
504.01360544217687
18+
],
19+
"laugh": [
20+
17000,
21+
1368.0045351473923
22+
],
23+
"loserSound": [
24+
20000,
25+
3631.0204081632664
26+
],
27+
"ohYeah": [
28+
25000,
29+
1071.020408163264
30+
],
31+
"quacking": [
32+
28000,
33+
6817.959183673466,
34+
true
35+
],
36+
"quak": [
37+
36000,
38+
783.6734693877575
39+
],
40+
"sniff": [
41+
38000,
42+
1985.306122448982,
43+
true
44+
],
45+
"thud": [
46+
41000,
47+
548.571428571428
48+
]
49+
}
50+
}

dist/audio.mp3

673 KB
Binary file not shown.

dist/audio.ogg

361 KB
Binary file not shown.

0 commit comments

Comments
 (0)