How do I make a sprite appear in conjunction with music

Just started using Construct 2? Post your questions here

Post » Thu Jul 09, 2015 2:35 pm

And then after that, I just set the action to spawn the sprite, Im assuming.
B
5
Posts: 27
Reputation: 571

Post » Thu Jul 09, 2015 2:40 pm

Something like this would work:

system compare two values : audio.playbacktime("Music") = 2
> system create sprite

this would create a sprite 2 seconds into the playing of the audio with the tag "Music"
You might want to add more conditions and or call a function to create the sprites, but these are the basics..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jul 10, 2015 1:56 am

So I could do that, I can make a sprite spawn using the function you just gave me, but would it be hard to do many of these functions each time I want to spawn a sprite. (potentially up to like 15-20 times during a 2-3 minute song).

So, Is there by any chance, an easier way to do all of this? Or is this the only way?
B
5
Posts: 27
Reputation: 571

Post » Fri Jul 10, 2015 8:29 am

I'm not sure what is hard about this..

If there is some logic behind the spawning event (amount of spawned objects, type of objects, etcetera) you might be able to use variables and functions to cut down on the amount of events, but basically the above event does exactly what you asked..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jul 10, 2015 9:45 am

Thanks.
I am trying to fix it.
B
5
Posts: 27
Reputation: 571

Post » Fri Jul 10, 2015 11:00 am

Just wondering, does the song file have to be in AAC format in order for it to work during runtime?
I tried M4A, and OGG and nothing else seemed to work.
B
5
Posts: 27
Reputation: 571

Post » Fri Jul 10, 2015 11:25 am

The audio.playbacktime("music") doesn't seem to work no matter what I do. I did everything correctly, the tags, everything.
B
5
Posts: 27
Reputation: 571

Post » Fri Jul 10, 2015 11:47 am

You probably need to use round(audio.playbacktime("music")) for it might not ever be exactly the amount you're aiming for..
If you need smaller amounts of time multiplying before rounding might work..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jul 10, 2015 3:49 pm

Thanks so much!
It works perfectly!
B
5
Posts: 27
Reputation: 571

Post » Sat Jul 11, 2015 3:18 am

Just checking, what does the "round" function do? I checked the manual, and I dont clearly understand why it made this function work. And also for future reference, what do you mean by mulitply before you round? I may need to make intervals shorter. How would multiplying help?

Sorry for bothering you so much,
Sharkmaster24
B
5
Posts: 27
Reputation: 571

PreviousNext

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests