Playing Audio Files

Playing Audio Files

You are here:
← All Topics

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