Skip to main content

addSound

Add a sound to the engine.

Syntax

engine.audio.addSound(item);

Parameters

NameTypeDescription
itemSoundItemThe sound to add to the engine.

Returns

  • Promise<boolean> - Whether the sound was added successfully.

Example

const success = await engine.audio.addSound({
soundName: 'fire',
url: 'https://example.com/fire.mp3',
});

console.log('Sound added:', success);

if (success) {
engine.audio.playSound('fire');
}

Available on: Client