added the sounds.js, added the .mp3's of the desired sound effects and exported to toplevel (#6)

master
Evan Powell 4 years ago
parent 469bbec9b7
commit 9c3a227271

@ -2,6 +2,7 @@ import {Component} from '../../lib/vues6.js'
import {GameState, ShipType} from '../module/util.js'
import {instructions} from '../module/lang.js'
import game_service from '../services/GameState.service.js'
import {GameSounds} from '../module/sounds.js'
const template = `
<div class="top-level-container">

@ -0,0 +1,29 @@
function sound(src) {
this.sound = document.createElement("audio");
this.sound.src = src;
this.sound.setAttribute("preload", "auto");
this.sound.setAttribute("controls", "none");
this.sound.style.display = "none";
document.body.appendChild(this.sound);
this.play = function(){
this.sound.play();
}
this.stop = function(){
this.sound.pause();
}
}
const GameSounds = {
Victory: new sound("/lib/sounds/cartoon_success_fanfair.mp3"),
Fire: new sound("/lib/sounds/zapsplat_warfare_mortar_projectile_launch_002_25232.mp3"),
Hit: new sound("/lib/sounds/zapsplat_warfare_bomb_whizz_in_hit_close_by_explosion_med_003_48060.mp3"),
Miss: new sound("/lib/sounds/zapsplat_nature_water_pour_medium_amount_deep_sudden_fast_002_52765.mp3"),
}
export{
GameSounds
}
Loading…
Cancel
Save