diff --git a/lib/game/entities/kuroneko.js b/lib/game/entities/kuroneko.js index 75eb3b6..57c1601 100644 --- a/lib/game/entities/kuroneko.js +++ b/lib/game/entities/kuroneko.js @@ -21,6 +21,7 @@ ig.module( is_dead: false, flip: false, kuro: true, + death: new ig.Sound('media/sounds/cat-dead.*'), animSheet: new ig.AnimationSheet('media/kuroneko.png', 32, 32), jumpSheet: new ig.AnimationSheet('media/kuroneko-jump.png', 46, 32), @@ -122,6 +123,7 @@ ig.module( kill: function() { this.is_dead = true; + this.death.play(); ig.game.removeEntity(this); ig.game.score = 0; diff --git a/lib/game/entities/mouse.js b/lib/game/entities/mouse.js index 878495a..898d33e 100644 --- a/lib/game/entities/mouse.js +++ b/lib/game/entities/mouse.js @@ -17,6 +17,7 @@ ig.module( flip: true, player: null, is_dead: false, + death: new ig.Sound('media/sounds/mouse-squeaking.*'), animSheet: new ig.AnimationSheet('media/mouse.png', 26, 9), @@ -81,6 +82,7 @@ ig.module( kill: function() { this.is_dead = true; + this.death.play(); this.speed = 0; this.collides = ig.Entity.COLLIDES.NEVER; setTimeout(function(){ig.game.removeEntity(this);}.bind(this), 500); diff --git a/lib/game/main.js b/lib/game/main.js index 948d35d..ba1f727 100644 --- a/lib/game/main.js +++ b/lib/game/main.js @@ -30,6 +30,9 @@ MyGame = ig.Game.extend({ boss: null, score: 0, checkpoint: null, + titlemusic: new ig.Sound('media/sounds/titlemusic.ogg'), + gamemusic: new ig.Sound('media/sounds/gamemusic.ogg'), + endmusic: new ig.Sound('media/sounds/gameend.ogg'), init: function() { @@ -42,6 +45,19 @@ MyGame = ig.Game.extend({ this.timer = new ig.Timer(5); this.cheesetimer = new ig.Timer(15); + + if (this.currentLevel == LevelTitle) { + this.titlemusic.play(); + } + + if (this.currentLevel == LevelLevel1 || this.currentLevel == LevelLevel2) { + this.titlemusic.stop(); + this.gamemusic.play(); + } + + if (this.currentLevel == LevelBadend || this.currentLevel == LevelGoodend) { + this.endmusic.play(); + } }, @@ -57,6 +73,7 @@ MyGame = ig.Game.extend({ if (this.currentLevel == LevelTitle) { //play title music + //this.titlemusic.play(); if (ig.input.pressed('space')) { this.loadLevel( LevelLevel1 ); } diff --git a/media/sounds/cat-dead.ogg b/media/sounds/cat-dead.ogg new file mode 100644 index 0000000..1813259 Binary files /dev/null and b/media/sounds/cat-dead.ogg differ diff --git a/media/sounds/gameend.ogg b/media/sounds/gameend.ogg new file mode 100644 index 0000000..c7ff91e Binary files /dev/null and b/media/sounds/gameend.ogg differ diff --git a/media/sounds/gamemusic.ogg b/media/sounds/gamemusic.ogg new file mode 100644 index 0000000..bccd58d Binary files /dev/null and b/media/sounds/gamemusic.ogg differ diff --git a/media/sounds/mouse-squeaking.ogg b/media/sounds/mouse-squeaking.ogg new file mode 100644 index 0000000..733c487 Binary files /dev/null and b/media/sounds/mouse-squeaking.ogg differ diff --git a/media/sounds/titlemusic.ogg b/media/sounds/titlemusic.ogg new file mode 100644 index 0000000..e5828ba Binary files /dev/null and b/media/sounds/titlemusic.ogg differ