• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows No Music

G

Gresse

Guest
Hey there,
This is the code in my music object (create event)
Code:
/// @description

//load audio grops
audio_group_load(Music);
audio_group_load(sound_effects);

//play some music
if room == rm_map1 {
    
    if audio_is_playing(sou_out_for_blood) {
        audio_sound_gain(sou_out_for_blood, 0, 1000);   
    }

    audio_play_sound(sou_playlist, 100, true);
    audio_sound_gain(sou_playlist, 0,0);
    audio_sound_gain(sou_playlist, 1, 2000);
} else {
    if audio_is_playing(sou_playlist) {
        audio_sound_gain(sou_playlist, 0, 1000);   
    }
    
    if not audio_is_playing(sou_out_for_blood) {
        audio_play_sound(sou_out_for_blood, 100, true);
        audio_sound_gain(sou_out_for_blood, 0,0);
        audio_sound_gain(sou_out_for_blood, 1, 1000);
    }
}
The Problem is that there is no music in my first room (rm_menu_main), but when i click and go to the next room (rm_map_menu) the music starts and when I go back through a bxk button the music continus)

What should I do if I want the music start in the first room??

Thank You and Sorry for my bad english :)
 
audio_group_load is an asynchronous function, which means that the rest of the code will continue to run. When you are checking the room and trying to play the music, the group has not completely loaded. You have to have an "Asynchronous Event - Save/Load" on your object and in that event do a check to confirm that all the groups have loaded and then start playing the audio.

audio_group_load: https://docs2.yoyogames.com/index.h...g/4_gml_reference/audio/audio_group_load.html
Asynchronous Events: https://docs2.yoyogames.com/index.h..._interface/1_editors/events/async_events.html
 
Top