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 8:32 am

Hello,

Basically all I need to know is how I can make a sprite appear in specific parts of a song, and disappear during others (used for a rhythm game).

Thanks,

Sharkmaster24
B
5
Posts: 27
Reputation: 571

Post » Thu Jul 09, 2015 9:05 am

I guess you can use timer that starts when music starts and at particular value of timer different events happen.
Or cut song into pieces and create sprite at the beggining of these pieces.

Otherwise I am not sure if that would be possible.
B
7
S
2
Posts: 68
Reputation: 645

Post » Thu Jul 09, 2015 9:16 am

Ah. Thats interesting. Ill look into it.
B
5
Posts: 27
Reputation: 571

Post » Thu Jul 09, 2015 9:28 am

How would you make particular actions come up at different points during the timer?
Is that even possible?
B
5
Posts: 27
Reputation: 571

Post » Thu Jul 09, 2015 11:46 am

Use the playback time of your audio file to cue your sprites. Check the manual for the specific event. Basically, compare if the playback time is greater or equal to a certain time, then (trigger once) create your sprites.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Thu Jul 09, 2015 11:53 am

Ok, but what if I need to create A LOT of sprites not just one. I want it to come up at specific points in the song always. Is there any way to speed the process up of when the sprites appear using some code, or would I have to do it manually? Would I have to use the timer behavior?
B
5
Posts: 27
Reputation: 571

Post » Thu Jul 09, 2015 12:00 pm

Sharkmaster24 wrote:Ok, but what if I need to create A LOT of sprites not just one. I want it to come up at specific points in the song always. Is there any way to speed the process up of when the sprites appear using some code, or would I have to do it manually? Would I have to use the timer behavior?


Would it be possible to use frames of one sprite for this sprite?
Or would you like to create many sprites at the same time?
If you want something different to happen at different moments, you'll probably have to write separate events..
If The events are (almost) the same, you might be able to use a function with parameters to get the result you want..
Timer behaviour could help, but I guess comparing audio.playbacktime would be perfect..
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 » Thu Jul 09, 2015 1:50 pm

Hmmm.
I think I will be able to use only one frames for one sprite for all.
I think that I can make the same sprite appear in multiple places at the same time (according to music speed, the sprites may have to appear on screen at the same time)

Sorry for being a noob, but what is audio.playbacktime?
What do I do with it?
B
5
Posts: 27
Reputation: 571

Post » Thu Jul 09, 2015 2:00 pm

From the Manual (isn't it great there is a link to it at the top of this page?):

Audio expressions:

PlaybackTime(Tag)
Get the current playback time in seconds of a sound with a tag. This starts at 0 and counts up to the duration, except for looping sounds which keep counting up past the duration.
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 » Thu Jul 09, 2015 2:33 pm

Thanks.
B
5
Posts: 27
Reputation: 571

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest