Candy Logo Copyright © 2025-2026 Candy Arts

Playing Media
In this tutorial, you will learn to play a sound during a Dialogue, with the Media_Play command, and to make the Dialogue wait until the sound ends, with the Media_Wait command. In a new scene, John visits Alice, and her phone rings while they talk. Alice ignores it, and only speaks again once the ringing has stopped. Before You Start This tutorial continues the Dialogue of the Text Input tutorial. It must be open in Candy Dialogue Creator: if you saved it (File > Save) and closed Candy Dialogue Creator since, open it again with File > Load Dialogue... 1. The Sound File Sounds are played by audio players. The dialogue UI provided with Candy Dialogue Engine contains several of them, and this tutorial uses the one named Sound: the SoundPlayer node of the dialogue UI scene. Each player plays the files of a folder named after it: the Sound player's files are in Candy_DE/Media/General/Audio/Sound. The sound of the phone, Phone_Ring.ogg, is already in that folder: it's part of the Media folder you copied in the Dialogue tutorial. It lasts three seconds: one second of silence, two rings in quick succession, and one more second of silence. 2. Writing the Scene 1. Add a Conversation named "Phone", as in the Conversations tutorial. 2. In its Block_1, add four Spoken Lines:
SpeakerPortraitText
AliceHappy.pngMore coffee, John?
John(empty)Is that your phone?
AliceSkeptical.pngIt must be the construction company again. Let it ring.
AliceHappy.pngThere. Peace and quiet at last.
3. Select the last Line, then open the Transition tab of the Buttons panel and click End. 3. Playing the Sound The phone starts ringing after Alice's first Line. 1. Select Alice's Line "More coffee, John?" 2. Open the Media tab of the Buttons panel, and click Media Play. The Media_Play command is added after Alice's Line, and its form is displayed. 3. In the Field Tree, on the left of the form, click + Player. Player 1 is added to the command, and selected. 4. In the name field, at the top of Player 1's fields, replace "Player_1" with "Sound", or click the field's v button and select Sound in the list. "Audio" is displayed on the right of the field: Candy Dialogue Creator found the Sound folder among your project's audio folders. 5. Click the v button on the left of the File field, and select Phone_Ring.ogg in the list. The list contains the files of the Sound folder. 6. In the Loops field, write "2".
Tutorial Media Play
Leave the other fields at their default value. How Media_Play Works A Media_Play command starts the players it lists, and the Dialogue continues at once: John's Line is displayed while the phone rings. • The name of the entry, Sound, designates the player that plays the file. • File names a file in the player's folder. • Loops sets how many times the file is played. With "2", the file is played twice: the phone rings twice, then twice again, and the Sound player stops. 4. Waiting for the Sound The two loops last six seconds. When John's and Alice's Lines are advanced quickly, "There. Peace and quiet at last." is displayed while the phone still rings. A Media_Wait command before that Line makes the Dialogue wait until the ringing ends. 1. Select Alice's Line "It must be the construction company again. Let it ring." 2. In the Media tab of the Buttons panel, click Media Wait. The Media_Wait command is added after Alice's Line. 3. In the Field Tree, click + Player. 4. In the name field, replace "Player_1" with "Sound", or select Sound in the list of the field's v button. 5. In the Wait Loops field, write "2".
Tutorial Media Wait
How Media_Wait Works When the Dialogue reaches the Media_Wait command, it waits until the Sound player has completed the number of loops set in Wait Loops, counted from the start of the playback. With "2", the Dialogue waits for the end of the second loop, then displays Alice's last Line. Meanwhile, the dialogue box continues to display Alice's previous Line. If the playback has already ended when the Dialogue reaches the Media_Wait command, the Dialogue doesn't wait. 5. Testing the Scene 1. Right-click Phone in the Dialogue Navigator, and select Test Here. 2. After Alice's first Line, press the key assigned to Dialogue_Advance. John's Line is displayed, and the phone rings one second later, after the silence at the start of the file. 3. Advance quickly through Alice's next Line. The Dialogue waits until the phone has rung four times, then displays "There. Peace and quiet at last." Test the scene again, advancing slowly: when the ringing has ended before you advance past Alice's Line, her last Line is displayed at once. If the Test Fails • The name field displays "Unknown type" instead of "Audio": Candy Dialogue Creator didn't find the Sound folder. Check that Candy_DE/Media/General/Audio/Sound exists, then click Refresh. • No sound is played: check that Phone_Ring.ogg is in the Sound folder, that the Godot Editor imported it, and that the File field is "Phone_Ring.ogg". • The phone rings only twice: check that the Loops field of the Media_Play command is "2". • The last Line is displayed while the phone still rings: check that the Media_Wait command's entry is named Sound, and that its Wait Loops field is "2". The phone now rings during the scene, and Alice's last Line waits for the ringing to end, however fast the Lines are advanced.