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

0 favourites
  • 3 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • 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?

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you! I'm going to try this out.

    EDIT: It worked! Thank you very much for helping!

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