0 Favourites

How do I setup same song for all levels

  • Hi guys,

    I have a little problem with the audio of my game.

    1. I have several layouts called menu, levels, tutorial (with his own music) and level 1, level 2 (with a different music).

    2. Each time I start a level, the audio begins with "On start of layout".

    3. Each time the character dies, the layout (level x) restarts with "Reset layout", therefore the audio overlaps the originally started with the layout. I have "solved" this with Audio "Stop all" every time the character dies, but the song starts again from the beginning.

    I want to put a single song for all levels and would be nice if it stop restarting each time the character dies and every time you go to next level. Something like a global song for all level layouts only.

    How can I solve this?

    Regards, Leonard.

  • you can add tags to the audio and check if it's play or not

    on start of layout

    if tag "musicLevel" not playing

    play audio with tag "musicLevel"

    you can add a var to it for the levels

    tag "musicLevel"&level

  • you can add tags to the audio and check if it's play or not

    on start of layout

    if tag "musicLevel" not playing

    play audio with tag "musicLevel"

    you can add a var to it for the levels

    tag "musicLevel"&level

    Yes, i was thinking about your first solution when the player dies, but i don't really know how to check if its playing or not.

  • add event -> audio -> is tag playing

  • add event -> audio -> is tag playing

    I can try that, but when the tag is playing, if the layout restarts and I set "Stop" then it stops all the music.

  • No you didn't understand what i meant,

    click on the audio is playing condition than click on "i" on the keyboard, this will reverse the event to checking false condition.

    delete the stop action

    and move the play action to the sub event

    now only if music is not playing the action will be called.

  • No you didn't understand what i meant,

    click on the audio is playing condition than click on "i" on the keyboard, this will reverse the event to checking false condition.

    delete the stop action

    and move the play action to the sub event

    now only if music is not playing the action will be called.

    Awesome ! That worked like a charm for the deaths, now I must try something for the other levels.

    Thank you Lof !

  • as i said before, have a var named level

    and check in the tag

    if music&level is not playing

    stop all

    play "music"&level with tag "music"&level

    than if you die and restart the same level the event will not be called.

    and if the level changes the music will stop and play the new music with a new tag

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • as i said before, have a var named level

    and check in the tag

    if music&level is not playing

    stop all

    play "music"&level with tag "music"&level

    than if you die and restart the same level the event will not be called.

    and if the level changes the music will stop and play the new music with a new tag

    Absolutely stunning skills :p thank you so much !

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