Interface PlaySfxOptions

Configuration options for playing sound effects with the playSfx function. Allows specifying the audio source to play, optional volume level (0-1), and whether the sound should loop continuously.

const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
playSfx({ audioSource });
const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
playSfx({ audioSource, volume: 0.5 });
const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
playSfx({ audioSource, loop: true });
interface PlaySfxOptions {
    audioSource: HTMLAudioElement;
    loop?: boolean;
    volume?: number;
}

Properties

audioSource: HTMLAudioElement
loop?: boolean
volume?: number