• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

Alarms/Countdown

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?
 
T

TinyGamesLab

Guest
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.
 
D

Dioramos

Guest
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.
Code:
//Step
if audio_sound_get_track_position (aMenuMusic) = 8
{
global.BR = true;
}
I made object with white rectangle sprite and write this to 'Step'. I tried draw, instance_create... But im noob and nothing works properly. Help pls
 
T

TinyGamesLab

Guest
Sure! Try this:

Creation 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;
Step code:
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;
}
 
D

Dioramos

Guest
Sure! Try this:

Creation 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;
Step code:
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;
}
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...
 
Top