I
Irishes
Guest
Can someone explain the issue with my logic? Currently, When I compile, all of the songs play at once or the same song is just playing strangely. It should add each song randomly to a new array called tracklist and then play each song consecutively.
-- Create Event --
/// Create Music Structure
musicArray[0] = snd_music_battle_for_endor_3;
musicArray[1] = snd_music_battle_for_endor_1;
musicArray[2] = snd_music_battle_for_yavin;
musicArray[3] = snd_music_tie_attack;
musicArray[4] = snd_music_sail_barge_assault_alt;
length = array_length_1d(musicArray);
for(i=0; i< length; i++){
index = choose(random_range(0, length));
trackListArray = musicArray[index];
}
--Step Event--
/// Play Song
i = 0;
currentSong = trackListArray;
audio_play_sound(currentSong, 1, 0);
while(!audio_is_playing(currentSong)){
i++;
currentSong = trackListArray;
audio_play_sound(currentSong, 1, 0);
}
-- Create Event --
/// Create Music Structure
musicArray[0] = snd_music_battle_for_endor_3;
musicArray[1] = snd_music_battle_for_endor_1;
musicArray[2] = snd_music_battle_for_yavin;
musicArray[3] = snd_music_tie_attack;
musicArray[4] = snd_music_sail_barge_assault_alt;
length = array_length_1d(musicArray);
for(i=0; i< length; i++){
index = choose(random_range(0, length));
trackListArray = musicArray[index];
}
--Step Event--
/// Play Song
i = 0;
currentSong = trackListArray;
audio_play_sound(currentSong, 1, 0);
while(!audio_is_playing(currentSong)){
i++;
currentSong = trackListArray;
audio_play_sound(currentSong, 1, 0);
}