0 Favourites

1 event sheet, sounds for multiple levels...possible?

  • Hi guys,

    i have a project with multiple levels (multiple layouts) but only one event sheet for comprehension and simplicity reasons.

    I need to play a different background music for every layout, how do i manage to do this with a single event sheet?

    Thanks in advance

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I'm not sure if this is the right way but this is just what I think would work. Create a global variable called "levelmusic" or something like that. Each value of that variable will be a level.

    Let's say levelmusic=1 means level 1, levelmusic=2 means the player reached level 2 and so on (make sure the initial value of the variable is 1, not zero; otherwise you'll get confused; unless you count your levels, level zero, level 1, level 2 etc.).

    Then in your eventsheet, write:

    On start of layout, and add subevents:

    if levelmusic=1, play the song for the 1st level

    if levlemusic=2, play song for level 2, etc...

    You will also need something like a trigger for that variable to change values. So, add an invisible sprite at the end of each level, and add an event in your sheet:

    player on collision with sprite (or whatever you want to call that), add 1 to levelmusic.

    This basically means, when the player touches that invisible sprite at the end of each level, 1 point will be added to your levelmusic variable. This way, your variable value will change everytime the player completes a level and the right song will play for every level. Hope I explained well, and I hope it helps XD

  • mmh, nice thank you, the invisible sprite probably will do the trick...i'll try. Thank you again

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