├── .babelrc
├── .eslintrc.json
├── .gitignore
├── README.md
├── assets
├── audio
│ ├── bck.mp3
│ ├── dead.wav
│ ├── finish.wav
│ ├── hurt.wav
│ ├── jump.wav
│ ├── pop.wav
│ ├── ring.wav
│ └── spring.wav
├── data
│ ├── level00.json
│ ├── level01.json
│ └── level02.json
└── images
│ ├── background.png
│ ├── bat.png
│ ├── block.png
│ ├── bug.png
│ ├── finish-static.png
│ ├── finish.png
│ ├── fireball.png
│ ├── hero.png
│ ├── invisible_wall.png
│ ├── lava.png
│ ├── letters.png
│ ├── numbers.png
│ ├── ring.png
│ ├── spike1.png
│ ├── spike3.png
│ ├── spring.png
│ ├── stone16x1.png
│ ├── stone1x1.png
│ ├── stone2x1.png
│ ├── stone4x1.png
│ └── stone8x1.png
├── config.xml
├── docs
├── assets
│ ├── audio
│ │ ├── bck.mp3
│ │ ├── dead.wav
│ │ ├── finish.wav
│ │ ├── hurt.wav
│ │ ├── jump.wav
│ │ ├── pop.wav
│ │ ├── ring.wav
│ │ └── spring.wav
│ ├── data
│ │ ├── level00.json
│ │ ├── level01.json
│ │ └── level02.json
│ └── images
│ │ ├── background.png
│ │ ├── bat.png
│ │ ├── block.png
│ │ ├── bug.png
│ │ ├── finish-static.png
│ │ ├── finish.png
│ │ ├── fireball.png
│ │ ├── hero.png
│ │ ├── invisible_wall.png
│ │ ├── lava.png
│ │ ├── letters.png
│ │ ├── numbers.png
│ │ ├── ring.png
│ │ ├── spike1.png
│ │ ├── spike3.png
│ │ ├── spring.png
│ │ ├── stone16x1.png
│ │ ├── stone1x1.png
│ │ ├── stone2x1.png
│ │ ├── stone4x1.png
│ │ └── stone8x1.png
├── index.html
└── js
│ ├── bundle.js
│ └── vendor.bundle.js
├── index.html
├── package-lock.json
├── package.json
├── src
├── config.js
├── constants
│ └── constants.js
├── index.html
├── main.js
├── sprites
│ ├── Block.js
│ ├── Enemy.js
│ ├── Fireball.js
│ ├── Hero.js
│ └── Spike.js
├── states
│ ├── LoadingState.js
│ ├── PlayState.js
│ └── SpriteState.js
└── utils.js
├── webpack.config.js
├── webpack.cordova.config.js
├── webpack.production.config.js
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["env"]
3 | }
4 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "babel-eslint",
3 | "extends": "standard",
4 | "parserOptions": {
5 | "ecmaVersion": 6,
6 | "sourceType": "module"
7 | },
8 | "env": {
9 | "browser": true
10 | },
11 | "rules": {
12 | "import/no-unresolved": [2]
13 | },
14 | "globals": {
15 | "phaser": true
16 | },
17 | "settings": {
18 | "import/core-modules": ["phaser", "pixi", "p2"]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | www/
3 | platforms/
4 | plugins/
5 | dist/
6 | .vscode/
7 | *.log
8 | /index.html
9 | build/
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sonic the Hedgehog Javascript Game
2 |
3 | Demo: https://rzencoder.github.io/sonic-hedgehog-game/
4 |
5 | Made a platform game to practice Javascript skills using the phaser.io framework
6 |
7 | Controls:
8 | * Left-Arrow: Move Left
9 | * Right-Arrow: Move Right
10 | * Up-Arrow: Jump
11 |
--------------------------------------------------------------------------------
/assets/audio/bck.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/bck.mp3
--------------------------------------------------------------------------------
/assets/audio/dead.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/dead.wav
--------------------------------------------------------------------------------
/assets/audio/finish.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/finish.wav
--------------------------------------------------------------------------------
/assets/audio/hurt.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/hurt.wav
--------------------------------------------------------------------------------
/assets/audio/jump.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/jump.wav
--------------------------------------------------------------------------------
/assets/audio/pop.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/pop.wav
--------------------------------------------------------------------------------
/assets/audio/ring.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/ring.wav
--------------------------------------------------------------------------------
/assets/audio/spring.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/audio/spring.wav
--------------------------------------------------------------------------------
/assets/data/level00.json:
--------------------------------------------------------------------------------
1 | {
2 | "platforms": [
3 | {"image": "stone:4x1", "x": 0, "y": 558},
4 | {"image": "stone:4x1", "x": 294, "y": 558},
5 | {"image": "stone:4x1", "x": 294, "y": 516},
6 | {"image": "stone:16x1", "x": 588, "y": 558},
7 | {"image": "stone:4x1", "x": 588, "y": 350},
8 | {"image": "stone:4x1", "x": 294, "y": 300},
9 | {"image": "stone:4x1", "x": 0, "y": 240},
10 | {"image": "stone:4x1", "x": 300, "y": 120},
11 | {"image": "stone:2x1", "x": 900, "y": 120}
12 | ],
13 | "movingBlocks": [
14 | {"image": "block", "x": 400, "y": 120}
15 | ],
16 | "lava": [
17 | {"image": "lava", "x": 168, "y": 558},
18 | {"image": "lava", "x": 210, "y": 558},
19 | {"image": "lava", "x": 252, "y": 558},
20 | {"image": "lava", "x": 462, "y": 558},
21 | {"image": "lava", "x": 504, "y": 558},
22 | {"image": "lava", "x": 546, "y": 558}
23 | ],
24 | "spike":[
25 | {"image": "spike3", "x": 680, "y": 574},
26 | {"image": "spike3", "x": 830, "y": 574},
27 | {"image": "spike3", "x": 620, "y": 370},
28 | {"image": "spike3", "x": 330, "y": 320},
29 | {"image": "spike3", "x": 440, "y": 137}
30 | ],
31 | "decoration": [
32 |
33 | ],
34 | "rings": [
35 | {"x": 70, "y": 535}, {"x": 100, "y": 535}, {"x": 130, "y": 535},
36 | {"x": 350, "y": 495}, {"x": 380, "y": 495}, {"x": 410, "y": 495},
37 | {"x": 670, "y": 325}, {"x": 700, "y": 325}, {"x": 730, "y": 325},
38 | {"x": 50, "y": 190}, {"x": 80, "y": 190}, {"x": 110, "y": 190},
39 | {"x": 650, "y": 85}, {"x": 680, "y": 85}, {"x": 710, "y": 85}
40 | ],
41 | "hero": {"x": 30, "y": 535},
42 | "enemies": [
43 | {"image": "bug", "x": 700, "y": 540, "gravity": true},
44 | {"image": "bat", "x": 800, "y": 480, "gravity": false},
45 | {"image": "bat", "x": 700, "y": 280, "gravity": false},
46 | {"image": "bat", "x": 240, "y": 190, "gravity": false},
47 | {"image": "bat", "x": 800, "y": 60, "gravity": false}
48 | ],
49 | "finish": {"x": 930, "y": 120},
50 | "spring": [
51 | {"x": 920, "y": 542}
52 | ],
53 | "fireball": [
54 | {"x": 231, "y": 570, "height": 350, "velocity": 220},
55 | {"x": 525, "y": 570, "height": 280, "velocity": 200}
56 | ]
57 | }
58 |
--------------------------------------------------------------------------------
/assets/data/level01.json:
--------------------------------------------------------------------------------
1 | {
2 | "spike": [
3 | {"image": "spike", "x": 500, "y": 340},
4 | {"image": "spike3", "x": 280, "y": 120},
5 | {"image": "spike3", "x": 440, "y": 120}
6 | ],
7 | "platforms": [
8 | {"image": "stone:4x1", "x": 0, "y": 558},
9 | {"image": "stone:2x1", "x": 0, "y": 364},
10 | {"image": "stone:8x1", "x": 200, "y": 100},
11 | {"image": "stone:8x1", "x": 200, "y": 0},
12 | {"image": "stone:1x1", "x": 480, "y": 322},
13 | {"image": "stone:1x1", "x": 280, "y": 322},
14 | {"image": "stone:2x1", "x": 878, "y": 558},
15 | {"image": "stone:16x1", "x": 536, "y": 0},
16 | {"image": "stone:16x1", "x": 606, "y": 154},
17 | {"image": "stone:16x1", "x": 606, "y": 42}
18 | ],
19 | "movingBlocks": [
20 | {"image": "block", "x": 168, "y": 530},
21 | {"image": "block", "x": 836, "y": 530},
22 | {"image": "block", "x": 836, "y": 322}
23 | ],
24 | "lava": [
25 | {"image": "lava", "x": 168, "y": 558},
26 | {"image": "lava", "x": 210, "y": 558},
27 | {"image": "lava", "x": 252, "y": 558},
28 | {"image": "lava", "x": 294, "y": 558},
29 | {"image": "lava", "x": 336, "y": 558},
30 | {"image": "lava", "x": 378, "y": 558},
31 | {"image": "lava", "x": 420, "y": 558},
32 | {"image": "lava", "x": 462, "y": 558},
33 | {"image": "lava", "x": 504, "y": 558},
34 | {"image": "lava", "x": 546, "y": 558},
35 | {"image": "lava", "x": 588, "y": 558},
36 | {"image": "lava", "x": 630, "y": 558},
37 | {"image": "lava", "x": 672, "y": 558},
38 | {"image": "lava", "x": 714, "y": 558},
39 | {"image": "lava", "x": 756, "y": 558},
40 | {"image": "lava", "x": 798, "y": 558},
41 | {"image": "lava", "x": 840, "y": 558}
42 | ],
43 | "decoration": [
44 |
45 | ],
46 | "rings": [
47 | {"x": 80, "y": 535}, {"x": 110, "y": 535}, {"x": 140, "y": 535},
48 | {"x": 500, "y": 510}, {"x": 530, "y": 510}, {"x": 560, "y": 510},
49 | {"x": 375, "y": 260}, {"x": 405, "y": 260}, {"x": 435, "y": 260},
50 | {"x": 650, "y": 120}, {"x": 680, "y": 120}, {"x": 710, "y": 120}
51 | ],
52 | "hero": {"x": 21, "y": 525},
53 | "enemies": [
54 | {"image": "bug", "x": 700, "y": 140, "gravity": true},
55 | {"image": "bat", "x": 900, "y": 290, "gravity": false},
56 | {"image": "bat", "x": 100, "y": 260, "gravity": false},
57 | {"image": "bat", "x": 390, "y": 60, "gravity": false}
58 | ],
59 | "finish": {"x": 930, "y": 154},
60 | "spring": [
61 | {"x": 920, "y": 542},
62 | {"x": 15, "y": 348}
63 | ],
64 | "fireball": [
65 | {"x": 530, "y": 570, "height": 190, "velocity": 120}
66 | ]
67 | }
--------------------------------------------------------------------------------
/assets/data/level02.json:
--------------------------------------------------------------------------------
1 | {
2 | "platforms": [
3 | {"image": "stone:16x1", "x": 70, "y": 558},
4 | {"image": "stone:16x1", "x": 0, "y": 432},
5 | {"image": "stone:2x1", "x": 0, "y": 558},
6 | {"image": "stone:2x1", "x": 912, "y": 558},
7 | {"image": "stone:2x1", "x": 605, "y": 432},
8 | {"image": "stone:2x1", "x": 155, "y": 516},
9 | {"image": "stone:2x1", "x": 292, "y": 474},
10 | {"image": "stone:2x1", "x": 426, "y": 516},
11 | {"image": "stone:2x1", "x": 605, "y": 390},
12 | {"image": "stone:2x1", "x": 0, "y": 390},
13 | {"image": "stone:4x1", "x": 100, "y": 160},
14 | {"image": "stone:1x1", "x": 380, "y": 118},
15 | {"image": "stone:1x1", "x": 780, "y": 118},
16 | {"image": "stone:2x1", "x": 918, "y": 118}
17 | ],
18 | "movingBlocks": [
19 | {"image": "block", "x": 43, "y": 360},
20 | {"image": "block", "x": 564, "y": 118}
21 | ],
22 | "lava": [
23 | {"image": "lava", "x": 702, "y": 558},
24 | {"image": "lava", "x": 744, "y": 558},
25 | {"image": "lava", "x": 786, "y": 558},
26 | {"image": "lava", "x": 828, "y": 558},
27 | {"image": "lava", "x": 870, "y": 558},
28 | {"image": "lava", "x": 42, "y": 390},
29 | {"image": "lava", "x": 84, "y": 390},
30 | {"image": "lava", "x": 126, "y": 390},
31 | {"image": "lava", "x": 168, "y": 390},
32 | {"image": "lava", "x": 210, "y": 390},
33 | {"image": "lava", "x": 252, "y": 390},
34 | {"image": "lava", "x": 294, "y": 390},
35 | {"image": "lava", "x": 336, "y": 390},
36 | {"image": "lava", "x": 378, "y": 390},
37 | {"image": "lava", "x": 420, "y": 390},
38 | {"image": "lava", "x": 462, "y": 390},
39 | {"image": "lava", "x": 504, "y": 390},
40 | {"image": "lava", "x": 546, "y": 390},
41 | {"image": "lava", "x": 588, "y": 390}
42 | ],
43 | "spike": [
44 | {"image": "spike3", "x": 265, "y": 575},
45 | {"image": "spike3", "x": 400, "y": 575},
46 | {"image": "spike", "x": 400, "y": 133},
47 | {"image": "spike", "x": 800, "y": 133}
48 | ],
49 | "decoration": [
50 |
51 | ],
52 | "rings": [
53 | {"x": 167, "y": 500}, {"x": 197, "y": 500}, {"x": 227, "y": 500},
54 | {"x": 437, "y": 500}, {"x": 467, "y": 500}, {"x": 497, "y": 500},
55 | {"x": 120, "y": 140}, {"x": 150, "y": 140}, {"x": 180, "y": 140},
56 | {"x": 615, "y": 375}, {"x": 645, "y": 375}, {"x": 675, "y": 375}
57 | ],
58 | "hero": {"x": 21, "y": 525},
59 | "enemies": [
60 | {"image": "bug", "x": 700, "y": 540, "gravity": true},
61 | {"image": "bug", "x": 110, "y": 140, "gravity": true},
62 | {"image": "bat", "x": 800, "y": 50, "gravity": false},
63 | {"image": "bat", "x": 60, "y": 300, "gravity": false},
64 | {"image": "bat", "x": 900, "y": 500, "gravity": false}
65 | ],
66 | "finish": {"x": 940, "y": 120},
67 | "spring": [
68 | {"x": 920, "y": 542},
69 | {"x": 15, "y": 374}
70 | ],
71 | "fireball": [
72 | {"x": 780, "y": 558, "height": 200, "velocity": 150},
73 | {"x": 850, "y": 558, "height": 250, "velocity": 220},
74 | {"x": 310, "y": 380, "height": 300, "velocity": 220},
75 | {"x": 500, "y": 380, "height": 300, "velocity": 220}
76 | ]
77 | }
--------------------------------------------------------------------------------
/assets/images/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/background.png
--------------------------------------------------------------------------------
/assets/images/bat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/bat.png
--------------------------------------------------------------------------------
/assets/images/block.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/block.png
--------------------------------------------------------------------------------
/assets/images/bug.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/bug.png
--------------------------------------------------------------------------------
/assets/images/finish-static.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/finish-static.png
--------------------------------------------------------------------------------
/assets/images/finish.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/finish.png
--------------------------------------------------------------------------------
/assets/images/fireball.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/fireball.png
--------------------------------------------------------------------------------
/assets/images/hero.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/hero.png
--------------------------------------------------------------------------------
/assets/images/invisible_wall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/invisible_wall.png
--------------------------------------------------------------------------------
/assets/images/lava.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/lava.png
--------------------------------------------------------------------------------
/assets/images/letters.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/letters.png
--------------------------------------------------------------------------------
/assets/images/numbers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/numbers.png
--------------------------------------------------------------------------------
/assets/images/ring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/ring.png
--------------------------------------------------------------------------------
/assets/images/spike1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/spike1.png
--------------------------------------------------------------------------------
/assets/images/spike3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/spike3.png
--------------------------------------------------------------------------------
/assets/images/spring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/spring.png
--------------------------------------------------------------------------------
/assets/images/stone16x1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/stone16x1.png
--------------------------------------------------------------------------------
/assets/images/stone1x1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/stone1x1.png
--------------------------------------------------------------------------------
/assets/images/stone2x1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/stone2x1.png
--------------------------------------------------------------------------------
/assets/images/stone4x1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/stone4x1.png
--------------------------------------------------------------------------------
/assets/images/stone8x1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rzencoder/sonic-hedgehog-game/499fdf307d37736a853a9eafa980695d789cc318/assets/images/stone8x1.png
--------------------------------------------------------------------------------
/config.xml:
--------------------------------------------------------------------------------
1 |
2 |