How do I make a sprite appear in conjunction with music

0 favourites
From the Asset Store
6 looping tracks to use in your games and projects. These tracks are in the style of the 1960s detective movie genre.
  • 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

  • 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.

  • Ah. Thats interesting. Ill look into it.

  • How would you make particular actions come up at different points during the timer?

    Is that even possible?

  • 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.

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

  • 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..

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

  • 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.

  • Thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • And then after that, I just set the action to spawn the sprite, Im assuming.

  • 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..

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

  • 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..

  • Thanks.

    I am trying to fix it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)