This core feature adds an AudioStreamPlayer
create a src/core/sound.gd
extends 'res://fox/core/sound.gd'
and add it as Autoload
then you can implement the play
like this:
var OGG = {
onButtonPress = "res://path/to/your-sound.ogg",
music = "res://path/to/your-music.ogg",
}
func play(soundName):
var assetPath =__.Get(soundName, OGG)
if(assetPath):
.play(assetPath)
Now you can call Sound.play('music')
anywhere
.ogg
files will loop by default.
- Select them on the
FileSystem
, - go to the
Import
tab next to theScene
tab - unselect
loop
- click on
Reimport
onButtonPress