Categories
Tutorials

Looping Background Music With Intro in Godot Engine

Title is a mouthful, right? But this is something I’ve been trying and failing to find a clear answer to for months. Now that I’ve found the answer, time to take Sal‘s advice and write a blog post.

The Basic Idea

You’re making a video game. You’re using Godot because you like open source and free stuff. You’ve got some kick-awesome background music because, well, reasons. And while you can get a good loop out of the music, you’d still like to have an introduction to the music.

Background music with an intro is pretty standard in most video game music. Take a listen to “Green Hill Zone” from… well, every Sonic game ever. But particularly Sonic Mania.

Notice how when the music loops at 0:53, it doesn’t go all the way back to the beginning but instead loops from partway into the music? This helps set the stage for the level’s atmosphere and provide a more natural feel to the music.

It’s also a feature we’ve come to expect as players, so if you can do it in your game it’s a good idea. So how do we get it in Godot?