Skip to content

Commit

Permalink
Added volume controls to sound effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Deseteral committed Oct 1, 2023
1 parent 8aadb34 commit 70e1caf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sound/sound-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export abstract class SoundPlayer {
* Plays sound of given name, that can be optionaly looped.
* Returns unique id representing this specific playback (to be used e.g. for stopping).
*/
public static playSound(name: string, loop: boolean = false): SoundPlaybackId {
public static playSound(name: string, loop: boolean = false, volume: number = 1): SoundPlaybackId {
const { howl } = Assets.sound(name);
const id = howl.play();
howl.loop(loop, id);
howl.volume(volume, id);

this.idToName.set(id, name);
return id;
Expand Down

0 comments on commit 70e1caf

Please sign in to comment.