Is there a way to change music on layouts with same sheets?

Just started using Construct 2? Post your questions here

Post » Sat Apr 08, 2017 7:51 pm

Basically I have 2 layouts, that behave the same, so they use the same Event Sheet. But I want to make a different music loop for each layout. So when I change from Layout 1 to Layout 2 the music changes, using only one event sheet, because I'm trying to reduce the number of events. Is this possible?
B
4
Posts: 2
Reputation: 218

Post » Sun Apr 09, 2017 6:24 am

@Fupicat

You can compare the LayoutName value in an event with the System->Compare two values condition then set the music to play based on that.

Or if you really want to cut down on events, in an existing event you might have like On start of layout, add the Audio->Play by name action with the name set to:
LayoutName = "Layout 1" ? "L1 Music" : "L2 Music"

Obviously change the names to whatever you're actually using.

You can also expand that if you add more layouts:
LayoutName = "Layout 1" ? "L1 Music" : LayoutName = "Layout 2" ? "L2 Music" : "L3 Music"

Edit: Actually you can simplify things by naming your music the same as your layouts and just setting Audio->Play by name to LayoutName
Find all the Construct 2 games that were on Steam Greenlight here
B
33
S
9
G
7
Posts: 451
Reputation: 6,782

Post » Sun Apr 09, 2017 11:01 am

Thank you! I'm going to try this out.

EDIT: It worked! Thank you very much for helping!
B
4
Posts: 2
Reputation: 218


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests