Topic was automatically imported from the old Question2Answer platform.
Asked By
unuselessGamer
I Am new to godot engine and to game development in general!
alhamdullah i finished “Your first 2D game” Tutorial (by godot) but at the very last step (the “Finishing up” part) i had to add music to my game (using the given asset “House In a Forest Loop.ogg”) but i’ve noticed that it lasts for only 25 seconds witch is very short and will stop suddenly when players reaches a high score! so i tried to enable loop but lo and behold i cant even enable it!
I have no idea what to do i looked it up and could’nt find a solution! changing the audio format does’nt help either!
anyone knows what i am missing? this is frustrating
Looping with ogg files works fine (it has been the default for ages). As jgodfrey indicated, you may need to enable looping in the import dialog if looping has been disabled for some reason.
stormreaver | 2023-04-24 15:55
Interesting, I’ve never been able to loop ogg files by default, in v3 or v4… never thought to try the re-import… learnt something new!
Another way that i like to do this is by playing the song again when it get finished!
Here’s an example
First go into your AudioStreamPlayer2d Signals and select finished.
(Sorry i am new user that newly created a Godot account so I cannot give more than 1 Screenshots)
After that connect the signal to your scripts.
Your approach worked well for my MP3 music. I think it can be a good practice to just use finished signal for looping music for any kind of AudioStreamPlayer node because it makes the whole process format independent.