Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

bitsy

a little engine for little games, worlds, and stories · By adam le doux

Music gets interrupted dialogue

A topic by vaasu created Oct 07, 2023 Views: 574 Replies: 10
Viewing posts 1 to 4

Hi this is might be very simple, but I couldn't find the answer in the documentation. I was wondering how to make it so that the music keeps playing during dialogue. Right now, if I talk to someone the music pauses until the dialogue is finished and then it resumes. Thank you!

Hi Vaasu, I don't think it's possible with the “tune” music in Bitsy, but I played a game with music added with the “bitsymuse hack by Sean S. Leblanc” and music does not stop during dialogs. I never tried any hack, but hope that can help you!

Hi thanks for the reply! I actually figured out a way to do this for my game by modifying the html file a little and adding a few lines of code.

Hi vaasu! How did you end up figuring this out?

Hi, so I modified the html file for the game a little bit to add the music from external audio files. It's not a super clean way to do this, but it works if you're just doing something small like I was. Essentially, I checked the room transitions and if the player was going into a specific room, I would change the music.

First at the bottom of the game's html file, I added this code so there's audio element with an id that I could call.

Then, I added code here to check for the room transitions.Note that I changed the src to "" when I didn't want any music in a room. Also, make sure your audio files are in the same folder as the html file. There are many other ways to do this, and depending on what exactly you're trying to do, you will need to modify the code differently.

gotcha thank you! how do you find it sounds when it loops?

Hi could you explain your question more? I don't really understand what you mean

When the song restarts does it skip a beat or does it go immediately back to the start?

oh when the song ends, it just loops again back to the start.

Another solution to the original question is to search the html file for 

if (soundPlayer) {
    soundPlayer.pauseTune();

and just comment it out by adding two forward slashes before the "pauseTune" part, like so:

if (soundPlayer) {
    //soundPlayer.pauseTune();

But be aware: every time you save your game from the Bitsy maker it will restore this piece of code. So you'll have to comment out the "pauseTune" code in the html file after editing your game in Bitsy, but before your game is played.

Hi, this is a a great solution, thanks! For the project I was working on, I ended up using an external audio file from an open source library, but for anyone that wants to use music made in bitsy, this seems good.