• 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!

Legacy GM Music files not playing properly

F

FamousRob

Guest
Hi folks,

I've put a bunch of music files into my game for different levels - but for some reason it will only play one of them.
I had it set to pick one at random, and it would ALWAYS play the same one.
I just did it so I could press a key to pick a song, and it still only plays that song.

I've checked, and each sound reference has the correct MP3 file, and they playback within the 'edit sound' box.
Code used below for music select, 'control_music' is the only one that plays - even if I press a button marked for one of the other files!

Code:
if keyboard_check(1) && musicplay=0
{audio_play_sound(control_music,0,y);
audio_sound_gain(control_music, 0.3, 0);
musicplay=1}

if keyboard_check(2) && musicplay=0
{audio_play_sound(music_mega1,0,y);
audio_sound_gain(music_mega1, 0.3, 0);
musicplay=1}

if keyboard_check(3) && musicplay=0
{audio_play_sound(music_mega2,0,y);
audio_sound_gain(music_mega2, 0.3, 0);
musicplay=1}

if keyboard_check(4) && musicplay=0
{audio_play_sound(music_rock1,0,y);
audio_sound_gain(music_rock1, 0.3, 0);
musicplay=1}

if keyboard_check(5) && musicplay=0
{audio_play_sound(music_sawish,0,y);
audio_sound_gain(music_sawish, 0.3, 0);
musicplay=1}
Any ideas anyone?

Thanks in advance!
 

Llama_Code

Member
Also, when you had it set to random, it always played the same one because GameMaker always uses the same seed every run to make debugging easier, so it will always pick the same one. To make it truly random call

randomize() ;

At game start to get a random seed for a truly random choice.
 
Top