Skip to content

Commit

Permalink
Merge pull request #80 from euharrison/readd-sons
Browse files Browse the repository at this point in the history
sons de volta
  • Loading branch information
Mario Montenegro Gesteira authored Aug 2, 2016
2 parents a9f2380 + c54c000 commit 65f6633
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 0 deletions.
11 changes: 11 additions & 0 deletions assets/js/gameStates/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var loadState = {
game.load.setPreloadSprite(progressBar);

var SPRITES_DIR = 'assets/sprites/';
var SONS_DIR = 'assets/sons/';

game.load.image('bg', SPRITES_DIR + 'bg/bg.png');
game.load.image('bg-sky', SPRITES_DIR + 'bg/bg-sky.png');
Expand Down Expand Up @@ -60,6 +61,16 @@ var loadState = {
game.load.spritesheet('player', SPRITES_DIR + 'player.png', 150, 120);
game.load.spritesheet('rastro', SPRITES_DIR + 'rastro.png', 165, 81);

game.load.audio('bolha_ou_pulo1', SONS_DIR + 'bolha_ou_pulo1.wav');
game.load.audio('bolha_ou_pulo2', SONS_DIR + 'bolha_ou_pulo2.wav');
game.load.audio('cai_na_agua', SONS_DIR + 'cai_na_agua.wav');
game.load.audio('coco_canhao', SONS_DIR + 'coco_canhao.wav');
game.load.audio('hit', SONS_DIR + 'hit.wav');
game.load.audio('morte_boiando', SONS_DIR + 'morte_boiando.wav');
game.load.audio('musica', SONS_DIR + 'musica.wav');
game.load.audio('nada', SONS_DIR + 'nada.wav');
game.load.audio('power_up', SONS_DIR + 'power_up.wav');

// Load physics data json
game.load.physics('physicsData', 'assets/physics/collision.json');
},
Expand Down
12 changes: 12 additions & 0 deletions assets/js/gameStates/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ var menuState = {
text.anchor.setTo(0, 1);

game.input.onTap.add(this.start, this);

game.coliformiaSounds = {};

game.coliformiaSounds.bolha_ou_pulo1 = game.add.audio('bolha_ou_pulo1');
game.coliformiaSounds.bolha_ou_pulo2 = game.add.audio('bolha_ou_pulo2');
game.coliformiaSounds.cai_na_agua = game.add.audio('cai_na_agua');
game.coliformiaSounds.coco_canhao = game.add.audio('coco_canhao');
game.coliformiaSounds.hit = game.add.audio('hit');
game.coliformiaSounds.morte_boiando = game.add.audio('morte_boiando');
game.coliformiaSounds.musica = game.add.audio('musica');
game.coliformiaSounds.nada = game.add.audio('nada');
game.coliformiaSounds.power_up = game.add.audio('power_up');
},

start: function() {
Expand Down
8 changes: 8 additions & 0 deletions assets/js/gameStates/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ var playState = {
this.scoreText.anchor.setTo(0.5);

this.isJumping = false;

game.coliformiaSounds.nada.loopFull(0.5);
game.coliformiaSounds.musica.loopFull(0.1);
},

update: function() {
Expand Down Expand Up @@ -125,10 +128,13 @@ var playState = {
},

enemyCollisionHandler: function(body1, body2) {
game.coliformiaSounds.nada.stop();
game.coliformiaSounds.hit.play();
this.die();
},

powerupCollisionHandler: function(body1, body2) {
game.coliformiaSounds.power_up.play();
if (body2.sprite) {
body2.sprite.destroy();
}
Expand All @@ -141,6 +147,8 @@ var playState = {

die: function() {
if (this.player.alive) {
game.coliformiaSounds.musica.stop();
game.coliformiaSounds.morte_boiando.play();
this.playerlife.current = 0;
this.player.alive = false;
this.player.body.clearShapes();
Expand Down
1 change: 1 addition & 0 deletions assets/js/playState/levelItem/sewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Sewer.prototype.releaseCocolito = function() {

var tween = this.game.add.tween(this.sewer).to({ x: isso.sewer.x+33 }, 500, Phaser.Easing.Elastic.In);
tween.onComplete.add(function() {
this.game.coliformiaSounds.coco_canhao.play();
this.play.pool.get('cocolito',this.sewer.x, this.sewer.y+80);
this.tween({ x: isso.sewer.x-33 }, this.nextStep);
}, this);
Expand Down
16 changes: 16 additions & 0 deletions assets/js/playState/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ Player.prototype.update = function() {
this.angle = this.body.velocity.y/15;
this.body.rotation = this.angle * Math.PI / 180;

if (this.isJumping && !(this.body.y < this.initialPosition.y))
{
game.coliformiaSounds.cai_na_agua.play();
if (this.alive) {
game.coliformiaSounds.nada.loopFull(0.5);
}
} else if(!this.isJumping && (this.body.y < this.initialPosition.y)) {
if(Math.random() > 0.5)
{
game.coliformiaSounds.bolha_ou_pulo1.play();
} else {
game.coliformiaSounds.bolha_ou_pulo2.play();
}
game.coliformiaSounds.nada.stop();
}

//atualiza se está dentro da água ou não
this.isJumping = (this.body.y < this.initialPosition.y);

Expand Down
Binary file added assets/sons/bolha_ou_pulo1.wav
Binary file not shown.
Binary file added assets/sons/bolha_ou_pulo2.wav
Binary file not shown.
Binary file added assets/sons/bolhotas.mp3
Binary file not shown.
Binary file added assets/sons/cai_na_agua.wav
Binary file not shown.
Binary file added assets/sons/coco_canhao.wav
Binary file not shown.
Binary file added assets/sons/hit.wav
Binary file not shown.
Binary file added assets/sons/morte_boiando.wav
Binary file not shown.
Binary file added assets/sons/musica.wav
Binary file not shown.
Binary file added assets/sons/nada.wav
Binary file not shown.
Binary file added assets/sons/power_up.wav
Binary file not shown.

0 comments on commit 65f6633

Please sign in to comment.