D
Dioramos
Guest
I want to add bright effect to background with music sync. Example: when music reaches 5, 7, 15, 19, 33, 144... seconds, instantly spawn white (0.1 alpha) image and slowly "fade out" it. Is there an easy way to do this?
You can use audio_sound_get_track_position to get the amount of seconda that the track has been playing.
I would use it combined with a set of flags (ex f_5 = true) in order to know if the track had reached the desired position and spawn an object with the white image that slowly fades out.
//Step
if audio_sound_get_track_position (aMenuMusic) = 8
{
global.BR = true;
}
image_alpha = 0;
//list to hold times where Sprite appears
Time_list = ds_list_create();
ds_list_add(Time_list, 5, 7, 15, 19, 33, 144, 99999);
Part = 0;
//reduce alpha
image_alpha = min(image_alpha - 0.1, 0);
//check if part was reached
if (audio_sound_get_track_position (aMenuMusic) >= Time_list[| Part] )
{
Part += 1;
image_alpha = 1;
}
I added this code to the sprite, but it doesn't appears (i cant see it, but it exists in room). I tried to fix, unsuccessfully...Sure! Try this:
Creation code:
Step code:Code:image_alpha = 0; //list to hold times where Sprite appears Time_list = ds_list_create(); ds_list_add(Time_list, 5, 7, 15, 19, 33, 144, 99999); Part = 0;
Code://reduce alpha image_alpha = min(image_alpha - 0.1, 0); //check if part was reached if (audio_sound_get_track_position (aMenuMusic) >= Time_list[| Part] ) { Part += 1; image_alpha = 1; }