Implementing sound during menus

  • Hi guys,

    How do you implement your menu's music?

    I want a single sound to play along all my menus, but I'm hitting a wall trying to implement it.

    I've tried some ways already, but it won't work out.

    It would be really easy if we had an event such as:

    If Sound "X" is playing -> Do such.

    But we don't right? :(

  • Well, that was easier than I expected.

    You simply need a variable to control it all.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Care to elaborate? This is something that I plan on doing with my game but hadn't considered that the music would cut out between screens.

  • Sure:

    I have a global variable called "soundPlaying", which is initially set to 0.

    Whenever I enter a menu layout, I do the following:

    If soundPlaying == 0 -> set soundPlaying to 1, play "menuLoop"

    This way, whenever I leave the initial layout, it's always set to 1, and hence, the sound won't overlap itself.

    When I go to a Level Layout, as it has a different music loop, I simply stop the menuLoop music.

    When the user comes back from the level, I set "soundPlaying" to 0 again, so it starts playing again in the menus.

  • Nice one, thanks :)

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