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

Get help using Construct 2

Post » Fri Sep 30, 2016 10:00 am

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
Posts: 6
Reputation: 212

Post » Fri Sep 30, 2016 12:36 pm

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
Posts: 2
Reputation: 690

Post » Fri Sep 30, 2016 12:56 pm

mmh, nice thank you, the invisible sprite probably will do the trick...i'll try. Thank you again
Posts: 6
Reputation: 212

Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests