24 lines
No EOL
563 B
JavaScript
24 lines
No EOL
563 B
JavaScript
class Sound{
|
|
constructor(url){
|
|
this.assetsUrl = url;
|
|
}
|
|
|
|
loadSounds(){
|
|
this.shootSound = new Audio(this.assetsUrl + "shoot.mp3");
|
|
this.shootSound.type = "audio/mp3";
|
|
this.driftsound = new Audio(this.assetsUrl + "drift.mp3");
|
|
this.driftsound.type = "audio/mp3";
|
|
}
|
|
|
|
shoot(){
|
|
this.shootSound.pause()
|
|
this.shootSound.currentTime=0;
|
|
this.shootSound.play()
|
|
}
|
|
|
|
drift(){
|
|
this.driftsound.pause()
|
|
this.driftsound.currentTime=0;
|
|
this.driftsound.play()
|
|
}
|
|
} |