Skip to content
Snippets Groups Projects
Commit 750d5d34 authored by Paolo.Brasolin's avatar Paolo.Brasolin
Browse files

feat: #fe sound effects

parent 0150a793
No related branches found
No related tags found
No related merge requests found
File added
File added
File added
File added
File added
......@@ -54,6 +54,16 @@ export default class FightScene extends Phaser.Scene {
preload() {
this.preloadSprites();
this.preloadSoundsEffects();
}
preloadSoundsEffects() {
this.load.audio("sfx_lo_beep", "assets/audio/Cancel 1.wav");
this.load.audio("sfx_md_beep", "assets/audio/Text 1.wav");
this.load.audio("sfx_hi_beep", "assets/audio/Confirm 1.wav");
this.load.audio("sfx_hit_critter", "assets/audio/Hit damage 1.wav");
this.load.audio("sfx_hit_player", "assets/audio/Boss hit 1.wav");
this.load.audio("sfx_game_over", "assets/audio/Bubble heavy 2.wav");
}
preloadSprites() {
......@@ -315,7 +325,7 @@ export default class FightScene extends Phaser.Scene {
})
).data;
this.foes.forEach((foe) => foe.destroy());
this.scene.start("game_over");
this.sound.play("sfx_game_over");
}
initCluesGroup() {
......@@ -361,14 +371,17 @@ export default class FightScene extends Phaser.Scene {
});
if (match === null) {
// NOOP
this.sound.play("sfx_md_beep");
this.hud.showSubmitFeedback("white", inputStatus.final);
} else if (score < 0.9) {
// TODO: visual near misses based on score
this.sound.play("sfx_lo_beep");
this.updateScore(-1);
match.handleFailure();
this.hud.showSubmitFeedback("red", inputStatus.final);
new Spear(this, this.player, undefined);
} else {
this.sound.play("sfx_hi_beep");
backend.updateClue(match.beClue.id, {
ended_at: new Date().toISOString(),
ended_at_gmtm: this.getGameTime(),
......@@ -409,6 +422,7 @@ export default class FightScene extends Phaser.Scene {
});
};
this.typewriter.onChange = (inputStatus) => {
this.sound.play("sfx_md_beep");
this.hud.setInput(inputStatus.final);
};
}
......
......@@ -42,6 +42,7 @@ class Foe {
this.scene.player,
this.critter,
() => {
this.scene.sound.play("sfx_hit_player");
this.scene.physics.world.removeCollider(overlap);
this.scene.popFoe(this);
this.clue.delete();
......
......@@ -57,6 +57,7 @@ class Spear extends Phaser.Physics.Arcade.Sprite {
hitTarget() {
this.scene.physics.world.removeCollider(this);
this.scene.sound.play("sfx_hit_critter");
// TODO: bounce?
this.destroy();
this.target.flee();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment