Gameplay
Create sounds
Register sounds on the client and play them from gameplay code.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Register sounds on the client and play them from gameplay code.
import { provideClientModules } from "@rpgjs/client";
provideClientModules([
{
sounds: [
{
id: "item-pickup",
src: "sounds/item-pickup.mp3"
},
{
id: "battle-theme",
src: "sounds/battle-theme.mp3"
}
]
}
]);
player.playSound("item-pickup");
map.playSound("battle-theme", {
volume: 0.8,
loop: true
});
provideServerModules([
{
maps: [
{
id: "town",
sounds: ["town-bgm", "town-ambience"]
}
]
}
]);