0 Favourites

Music Selection

  • I'm working on a music puzzle game that lets you choose a music track before you enter the game layout. I'm unsure of exactly what steps I'm supposed to take to get this right.

    Would it be easier to have each music track match a global music number in case I end up having over a dozen tracks to select from? Or is there a better way that uses the preload and tag settings for each music track? The preload and tag settings are what I'm confused of how they work and how I pick which track I want.

    Any help would be appreciated. Thanks.

  • Still wondering if I can get a response to this.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • This is something simple I did: imgur.com/a/Ho1Hcrd

    I put the List object in a Music Selection layout for you to choose a song before going to the main game. There might be a way that's a little more efficient but this definitely works. The List object also may not fit the aesthetic of your game, so change it as you see fit. Just note that setting any music to play with a While-like command will try to play music every tick. On or When-like commands should be used.

    You shouldn't have to worry about setting up global variables for knowing which song to play. Music will continue to play between layouts unless you tell it to stop. So if you're always going to end up on the Music Selection layout before starting the game, you should be fine.

    Regarding preloading songs, make sure you're uploading your music to the Music folder, not the Sounds folder. As stated in the manual (https://www.scirra.com/manual/52/import-audio):

    It is important to organise audio files appropriately, because audio files in the Sounds project folder are downloaded completely before playing, but files in the Music folder are streamed. This means if a Music track is accidentally put in the Sounds folder, it would have to download completely (which could take a couple of minutes) before it started playing. However, audio in the Music folder can start playing immediately since it is streamed from the server.

    Regardings tags, they just make it easier to categorize your music or label it. In the code I shared above, I gave all the background music the "background music" tag so I could easily stop all of it when needed.

  • This is something simple I did: imgur.com/a/Ho1Hcrd

    I put the List object in a Music Selection layout for you to choose a song before going to the main game. There might be a way that's a little more efficient but this definitely works. The List object also may not fit the aesthetic of your game, so change it as you see fit. Just note that setting any music to play with a While-like command will try to play music every tick. On or When-like commands should be used.

    You shouldn't have to worry about setting up global variables for knowing which song to play. Music will continue to play between layouts unless you tell it to stop. So if you're always going to end up on the Music Selection layout before starting the game, you should be fine.

    Regarding preloading songs, make sure you're uploading your music to the Music folder, not the Sounds folder. As stated in the manual (https://www.scirra.com/manual/52/import-audio):

    > It is important to organise audio files appropriately, because audio files in the Sounds project folder are downloaded completely before playing, but files in the Music folder are streamed. This means if a Music track is accidentally put in the Sounds folder, it would have to download completely (which could take a couple of minutes) before it started playing. However, audio in the Music folder can start playing immediately since it is streamed from the server.

    Regardings tags, they just make it easier to categorize your music or label it. In the code I shared above, I gave all the background music the "background music" tag so I could easily stop all of it when needed.

    The List object? WHAAAAAT? I've never even heard of that object. Thanks for the info. I will try this out.

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