Playing Audio Files

← All Topics
You are here:

Playing Audio Files

You can play long background music or short sound effects by using the audio system for example:

audio.play "melody2"

Will play a long background file called “melody2”
While:

audio.play "explode1"

Will play a short explosion sound effect.
If you want your background music to play in a loop, just add the “loop” attribute to the audio.play command:

audio.play "melody2" loop

Note: there is no need to add the async attribute to the audio.play is a non-blocking command

Previous Move From One Entity To Another
Next Printing Text On The Screen