Skip to main content

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

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.