Skip to content

Commit

Permalink
add bullet_hit_2 sound
Browse files Browse the repository at this point in the history
  • Loading branch information
newagebegins committed Jun 24, 2012
1 parent 6ac5716 commit a98e961
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
Binary file added sound/bullet_hit_2.ogg
Binary file not shown.
8 changes: 4 additions & 4 deletions spec/PauseSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe("Pause", function () {
var eventManager = new EventManager();
var pause = new Pause(eventManager);
spyOn(pause, 'keyPressed');
pause.notify({'name': Keyboard.Event.KEY_PRESSED, 'key': Keyboard.Key.P});
expect(pause.keyPressed).toHaveBeenCalledWith(Keyboard.Key.P);
pause.notify({'name': Keyboard.Event.KEY_PRESSED, 'key': Keyboard.Key.START});
expect(pause.keyPressed).toHaveBeenCalledWith(Keyboard.Key.START);
});
});

Expand All @@ -21,10 +21,10 @@ describe("Pause", function () {
spyOn(eventManager, 'fireEvent');
var pause = new Pause(eventManager);

pause.keyPressed(Keyboard.Key.P);
pause.keyPressed(Keyboard.Key.START);
expect(eventManager.fireEvent).toHaveBeenCalledWith({'name': Pause.Event.START});

pause.keyPressed(Keyboard.Key.P);
pause.keyPressed(Keyboard.Key.START);
expect(eventManager.fireEvent).toHaveBeenCalledWith({'name': Pause.Event.END});
});
});
9 changes: 7 additions & 2 deletions src/Bullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ Bullet.prototype.notify = function (event) {
this.destroy();
}
else if (this._wallCollision(event)) {
if (this._tank.isPlayer() && event.sprite instanceof SteelWall) {
SoundManager.play("bullet_hit_1");
if (this._tank.isPlayer()) {
if (event.sprite instanceof SteelWall) {
SoundManager.play("bullet_hit_1");
}
else if (event.sprite instanceof BrickWall) {
SoundManager.play("bullet_hit_2");
}
}
this.destroy();
}
Expand Down
1 change: 0 additions & 1 deletion src/Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Keyboard.Key.LEFT = 37;
Keyboard.Key.UP = 38;
Keyboard.Key.RIGHT = 39;
Keyboard.Key.DOWN = 40;
Keyboard.Key.P = 80;
Keyboard.Key.S = 83;
Keyboard.Key.SELECT = 17;
Keyboard.Key.START = 13;
Expand Down
2 changes: 1 addition & 1 deletion src/Pause.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Pause.prototype.keyPressed = function (key) {
if (!this._active) {
return;
}
if (key == Keyboard.Key.P) {
if (key == Keyboard.Key.START) {
this._pause = !this._pause;

if (this._pause) {
Expand Down
1 change: 1 addition & 0 deletions src/SoundManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var SoundManager = (function() {
game_over: null,
bullet_shot: null,
bullet_hit_1: null,
bullet_hit_2: null,
explosion_1: null,
explosion_2: null,
pause: null,
Expand Down

0 comments on commit a98e961

Please sign in to comment.