playfunction plays audio, either music or sounds.
To use the
playfunction, the game needs to have audio files loaded by adding them to the config file:
The audio engine used is Howler. Options added in the config of an audio file will also be passed to Howler. Refer to the Howler docs for possible options.
Once there are audio files loaded in the engine, audio can be played with the
playfunction at any time in the script:
play music musicName
Playing with mode
musicwill replace stop and replace the current music to play a new one. There is only one music playing at a time
play sound soundName
Playing with the mode
soundwill just play a sound, no matter what else is already playing.
It is also possible to pause or stop sounds or music:
stop music(no need to specify the name because there is only one music playing
stop sound soundName(name must be specified)
For example, one could do a dramatic pause of the music
play music suspense
play sound scary
talk character idle "Suddenly, something happened!"
play music # resume the music