Browse code

add musics

devnewton authored on 03/03/2018 11:29:48
Showing 8 changed files
1 1
new file mode 100755
2 2
Binary files /dev/null and b/app/assets/musics/opengameart/8-bit-music-pack-loopable/bgm_action_4.mp3 differ
3 3
new file mode 100644
... ...
@@ -0,0 +1,4 @@
1
+Authors: CodeManu
2
+License: CC-BY 3.0
3
+
4
+https://opengameart.org/content/8-bit-music-pack-loopable
0 5
\ No newline at end of file
1 6
new file mode 100644
... ...
@@ -0,0 +1,4 @@
1
+Authors: SketchyLogic
2
+License: CC-BY 3.0
3
+
4
+https://opengameart.org/content/hungry-dino-9-chiptune-tracks-10-sfx
0 5
\ No newline at end of file
1 6
new file mode 100644
2 7
Binary files /dev/null and b/app/assets/musics/opengameart/hungry-dino-9-chiptune-tracks-10-sfx/main.mp3 differ
3 8
new file mode 100644
4 9
Binary files /dev/null and b/app/assets/musics/opengameart/hungry-dino-9-chiptune-tracks-10-sfx/victory.mp3 differ
... ...
@@ -16,6 +16,6 @@ export class Help1 extends AbstractState {
16 16
     create() {
17 17
         super.create();
18 18
         this.game.add.image(0, 0, 'help1');
19
-        new MenuButton(this.game, "Continue", 200, 600, () => this.game.state.start('Help2'));
19
+        new MenuButton(this.game, "Continue", 200, 610, () => this.game.state.start('Help2'));
20 20
     }
21 21
 }
... ...
@@ -51,6 +51,8 @@ export class Level extends AbstractState {
51 51
         this.game.load.image('house_inside', 'sprites/opengameart/house_inside.png');
52 52
         this.game.load.image('misc', 'sprites/opengameart/misc.png');
53 53
         this.game.load.image('basket', 'sprites/devnewton/basket.png');
54
+        this.game.load.audio('level-music', 'musics/opengameart/8-bit-music-pack-loopable/bgm_action_4.mp3')
55
+        this.game.load.audio('victory-music', 'musics/opengameart/hungry-dino-9-chiptune-tracks-10-sfx/victory.mp3')
54 56
     }
55 57
 
56 58
     init(config: LevelConfig) {
... ...
@@ -62,6 +64,8 @@ export class Level extends AbstractState {
62 64
 
63 65
     create() {
64 66
         super.create();
67
+        this.game.sound.stopAll();
68
+        this.game.sound.play('level-music', 1, true);
65 69
 
66 70
         this.game.physics.startSystem(Phaser.Physics.ARCADE);
67 71
         const map = this.game.add.tilemap('map');
... ...
@@ -246,6 +250,8 @@ export class Level extends AbstractState {
246 250
             const boysWin = this.braCapturePoints.areAllCaptured();
247 251
             this.victory = boysWin || girlsWin;
248 252
             if (this.victory) {
253
+                this.game.sound.stopAll();
254
+                this.game.sound.play('victory-music', 1, false);
249 255
                 this.girlsTeam.forEachAlive((player) => {
250 256
                     let emo = new EmotionSprite(this.game, player.key, girlsWin ? 'happy' : 'sad');
251 257
                     emo.x = player.x;
... ...
@@ -11,11 +11,14 @@ export class Title extends AbstractState {
11 11
     preload() {
12 12
         this.game.load.image('school', 'title/school.jpg');
13 13
         this.game.load.image('logo', 'title/logo.png');
14
+        this.game.load.audio('main-music', 'musics/opengameart/hungry-dino-9-chiptune-tracks-10-sfx/main.mp3')
14 15
         MenuButton.preload(this.game);
15 16
     }
16 17
 
17 18
     create() {
18 19
         super.create();
20
+        this.game.sound.stopAll();
21
+        this.game.sound.play('main-music', 1, true);
19 22
         this.game.add.image(0, 0, 'school');
20 23
         let logo = this.game.add.sprite(this.game.world.centerX, 10, 'logo');
21 24
         logo.scale.x = 1.4;