User Tools

Site Tools


play_sound

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
play_sound [2017/04/26 14:59] justinplay_sound [2024/01/31 22:20] (current) justin
Line 2: Line 2:
 ---- ----
  
-Plays the specified sound effect once.+Plays the specified [[sound|sound effect]]. If the optional loop argument is set to true, the [[sound|sound effect]] will continue to play at the given interval of time (e.g. once per second) until stopped via the [[Stop Sound]] function.
  
 +====Signature:====
 <code python> <code python>
-play_sound(sound_name)+play_sound(sound_name, loop, interval)
 </code> </code>
  
 ^Argument^Description^Type^Required^ ^Argument^Description^Type^Required^
-|sound_name|Name of the sound effect to play.|[[String]]|Yes|+|sound_name|Name of the [[sound|sound effect]] to play.|[[String]]|Yes| 
 +|loop|Whether or not the [[sound|sound effect]] will loop or play only once. When true, it will loop until stopped via the [[Stop Sound]] function.|[[Boolean]]|No| 
 +|interval|Interval of time in seconds to wait between each playing of the [[sound|sound effect]] (only applicable when the loop argument is true).|[[Number]]|No| 
 + 
 +^Return Value^Description^Type^ 
 +|Sound ID|Returns a unique numeric ID that can be stored for later reference (e.g. to stop a looping sound via the [[Stop Sound]] function).|[[Number]]| 
 + 
 +<WRAP center round info 100%> 
 +The built-in [[Sound FX Generator]], accessed from the main toolbar along the top of the application, can be used to generate some basic 8-bit style [[sound|sound effects]]. 
 +</WRAP>
  
 ====Example:==== ====Example:====
-<code python+<code bauxite
-play_sound("door_open")+play_sound("alarm.wav", true, 1);
 </code> </code>
-//Results:// Plays the sound effect named "door_open".+//Results:// Plays the [[sound|sound effect]] named "alarm.wavonce every second until stopped.
  
 <WRAP center round tip 100%> <WRAP center round tip 100%>
-Use the **Play Sound** function to trigger a sound effect when the player opens a door or a treasure chest, or some event occurs that you'd like the player to hear regardless of where they are.+Use the **Play Sound** function to trigger a [[sound|sound effect]] when the player opens a door or a treasure chest, or an event occurs that you'd like the player to hear regardless of their location.
 </WRAP> </WRAP>
  
Line 26: Line 36:
 <WRAP half column> <WRAP half column>
 ====Editor Node:==== ====Editor Node:====
-{{:wiki:play_sound_node.png?nolink|}}+{{:play_sound_node.png?nolink|}}
 </WRAP> </WRAP>
  
play_sound.1493243953.txt.gz · Last modified: 2017/04/26 14:59 by justin