Xalezar
Member
Hi everyone, so I've created an HTML5 build of my game. I want to make sure that the background music for my title screen,
Note: I am using audio groups, and
Other question: How do I control which assets are loaded first? Background music files are often the largest, so I'd like to make sure a specific one bgm_title is loaded first, so that the audience will for sure hear the background music when they arrive at the title screen.
Current setup:
My background music logic is managed by an object,
When the game starts, I'll have an "init" screen that asks the user to click the game area, to enable the browser audio context. After they have clicked it, I execute
I tested it a few times and it seems to work in the browser. I.e. the
bgm_title
, loads before I enter that room otherwise the player will not hear the music and probably start the game and miss hearing bgm_title. What is the best way to accomplish this?Note: I am using audio groups, and
bgm_title
is in ag_bgm
. All audio groups are loaded right at the start of the game.Other question: How do I control which assets are loaded first? Background music files are often the largest, so I'd like to make sure a specific one bgm_title is loaded first, so that the audience will for sure hear the background music when they arrive at the title screen.
Current setup:
My background music logic is managed by an object,
audio_manager
, which continually checks if the current correct background music is playing. If not, then it will first stop whatever is playing then start playing the correct music (or play nothing, if silence was designated). It has a variable bgm_id which gets updated by calling a function audio_set_bgm();
.When the game starts, I'll have an "init" screen that asks the user to click the game area, to enable the browser audio context. After they have clicked it, I execute
audio_set_bgm( bgm_title, ... )
, the following code is run in the step event:
GML:
if ( clicked ) {
title = "Loading ..."
if ( audio_is_playing( bgm_title ) ) {
instance_destroy( obj_fade_from_black );
room_goto_ext( rm_title );
}
}
bgm_title
asset will load first, so that it plays when the title screen displayed. However, it sometimes randomly gets stuck in this "loading" stage and never seems to proceed.
Last edited: