A success jingle
Updated
On puzzle/solved, an Audio Tone schedules a rising C major arpeggio and a final chord in one go.
Press Solve puzzle to hear the jingle.
A success jingle
#pragma lifecycle(startup)
// Scene: an Audio Tone entity "Jingle Tone". Game code emits 'puzzle/solved'.let tone;
function startup() { tone = findEntity('Jingle Tone').getComponent(AudioToneComponent); tone.setProps({ oscillator: 'triangle', attack: 0.01, decay: 0.2, sustain: 0.4, release: 0.6 });
on('puzzle/solved', () => { const step = 0.12; tone.play('C5', step, 0); tone.play('E5', step, step); tone.play('G5', step, step * 2); tone.play(['C5', 'E5', 'G5', 'C6'], 0.8, step * 3); });}How it works
Section titled “How it works”The script is explained step by step in A success jingle.
Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
SuccessJingle.xrproj