0 Favourites

stop music at the end of a layout ?

  • can start it ... cant stop it ..

    every layer has a different soundtrack so it just sounds horrible

  • Use the event condition "On end of layout" and apply the action "Audio: Stop" and give the tag to the music playing.

  • You beat me to it, Kyatric. Here is an example that does just that.

    PlayStopMusic.capx

  • thanks guys, wow i must sit down and work this out :P ! no gettinga round it ...i have about 5 songs over 5 layouts...one layout is like a juke box with the full soundtrack

  • If you get time do you think you could help me to stick the music on the right stages? so much i dont understand...i can give you a list ?

    Take a look dl.dropbox.com/u/84483952/Milk%20of%20Ultra%20Violet.capx

  • You are no doubt feeling overwhelmed right now, but with a little organization things can become much simpler. Yes, I can help you, but you have to answer a few questions and layout a plan before we jump into fixing the project:

    1) Are you using the free or paid version of Construct 2? If you are using the free version, I'll make sure my suggestions only use features found in the free version.

    2) What kind of game is this? Is it simply the jukebox, or an interactive book, or is it more of an adventure game? The reason I ask is that if all of the levels except the Tracks level behave in the same way, you can have just one event sheet for all the ones that behave the same. (But if they are all different, there is still a good way to simplify things.)

    3) Can you make a list of each piece of music and the layout that it goes in? Once you have this list, I'll show you how to put it into an array or dictionary, and then you can easily grab the right piece of music from any layout.

  • Im on the free version, yep overwhelmed and so excited..:)

    Its a kind of hybrid of an old watch type game and a bit of an adventure...its not very long, but im going for such an emotional impact, especially with the graphical simplicity, music and Biblical stuff. its going to have an epic plot twist :P all in under one minute

    Ok heres the levels and the tracks ...thanks for the help :)

    library (layout) = for two (music)

    plot 1/plot 2,book = tech dead

    Nauseous Pines = slipping sands

    Busker = busker

    Noxtious Abyss = amniotic

    Ultra violet = Milk and honey

    Heaven gate = painted eyes

    Phone is the title screen, everything else should branch off there, "listen to tracks" now goes to a music website, easier :P

    Im hoping to have an onscreen counter on the levels with time limits... dont understand how it works yet though :P

    Hey thanks again :)

    this is the latest version...it all starts on "Phone" layout, enjoy :)

    dl.dropbox.com/u/84483952/Milk%20of%20Ultra%20Violet.capx

    hey check out the new video games arcade on the busker layout :)haha love this

  • Okay. I've made a model to show you what we're going to use for your project. It is much simpler than your project, so it should be easier for you to understand. And you need to understand it because otherwise if you break it you'll have no clue how to fix it. I plan to write up a tutorial for this project, but I don't want to make you wa

    MusicDictionary.capx

    Open it up and run it. You'll see the layout name (Level 1) and four circle buttons. Click on a button and it takes you to the corresponding level (level 1, level 2, level 3 or level 4.) Notice that the music changes each time you change levels.

    Now look at Level Events, which is the event sheet for all of the levels. There is no code to start or stop the music.

    It is all handled in the two included event sheets you see mentioned at the top. The first of the included event sheets puts the names of the layouts and the music they should play in a dictionary. This included only needs to be included in the event sheet for the first layout in your project (your phone layout.)

    The second included event sheet uses the name of the current layout (LayoutName) to play music that it looks up in the dictionary. This event sheet has to be included in the event sheet for every layout that uses the dictionary to lookup and play music.

    So what does this mean to you?

    It helps you organize your project. It means you only have to go to one place to set the music for all of your layouts, much like the list I had you make out. And once you've included the event sheets to load the dictionary and play the music, you don't have to worry about them anymore!

    Now open up MusicDictionary Events and examine it. You'll be creating a Music Dictionary action for every layout in your game. I'll create a few of them for you and you can make the rest so you'll know how to do it.

    I'll also add the event sheets to a few of your layouts and you can do the rest, again so you'll know how to do it.

    By the time you've read this and looked at the project I hope to have your revised project up.

    Oh, and if you look in the forum in Kyatric's How do I Frequently Asked Questions, you'll find Countdown examples.

  • Okay, here it is. As I said, I didn't make all of the changes so that you could see how it works.

    Modify the MusicDictionary Events to include an action to add an entry for every layout that you want to play music by copying and pasting each and changing the name of the layout and the name of the music.

    Then for each level you want to play music, open the event sheet, right-click to include the Music Loader Events event sheet, delete any old on start/end of layout events to play/stop audio.

    Milk of Ultra Violet V2.capx

    I didn't get a chance to go through the whole thing, but from what I saw, very interesting style, looks like it could turn out great!

    By the way, when you get a chance you should rename your sprites to have more meaningful names instead of sprite<number>. You'll find it much easier to work with.

    Also, in part because they aren't very attractive, but mostly because it is hard to control their size and position, you might consider eliminating the Button objects and using sprites for the buttons instead. (See my last example with the pink circle "buttons" to see how to do it. this is more work than renaming the sprites, but again may be worth it.

  • Hey thanks for all the time you spend... i will spend time looking into it and hopefully learning the lessons...

    The music to the "busker" layout wouldnt start though, or anything i added afterwards... does that mean that this system can only support a certain number of these ?

    also is there a way not to restart the track untill the end of the level (that way people get to hear the whole songs as they retry with trial and error)

    Its going to take me a while to learn this :P but music is sooo important to games...:P above graphics i think

  • ill get it, i just rush things to much :P gimme a day with it :P your right, if my layouts weren't such a clutter it would be easier :P

  • Hey thanks for all the time you spend... i will spend time looking into it and hopefully learning the lessons...

    The music to the "busker" layout wouldnt start though, or anything i added afterwards... does that mean that this system can only support a certain number of these ?

    Nope. There is no limit. I don't think I played to the busker level.You need to check to make sure that the load music events is included and that there is a correct row in the dictionary (which I think I put in.) Also you need to check to see if there are some other conflicting audio actions using the "music" tag.

    If you don't figure it out, repost it and I'll look at it.

    also is there a way not to restart the track untill the end of the level (that way people get to hear the whole songs as they retry with trial and error)

    Changing the specs on me, are you? I have to think about it. It'll take a change to the load music events sheet. But guess what! You only have to change it in one place to fix all of your layouts!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Okay, I changed it. Here is the new capx for my sample project

    MusicDictionaryV2.capx

    The only changes you need to make are to basically replace what is in the Load Music Events event sheet with what is in this new version. (Make sure you backup before you make the changes!)

    Two global variables were added to the event sheet. ReloadLevelMusicAction is the one you change to affect the way reload is handled. If ReloadLevelMusicAction=0, the music restarts when the level is reloaded, if ReloadLevelMusicAction=1 the music continues when the level is reloaded.

  • Thanks again, i think i finished that game now... it didnt quite work out the way i planned...the music didnt realy have the emotional impact ... its just plain strange :P i managed to work it out, i think i was the victim of my own spelling tbh ...so much easier the way you planned it , and cleaner :)

    this is the finished product for now... the ending has changed... if you get there you might think oh wow... used alot of the internet in the game to pretty good retro effect :P ...https://dl.dropbox.com/u/84483952/the%20milk%20of%20ultra%20violet%20retail/index.html

    ill will learn from your other posts , just making a shoot em up for a break ..."alien dolphin destroyers" even weirder :P

  • Congratulations on finishing a project. Even if it didn't turn out quite the way you hoped (and what does, really?) it's a major accomplishment!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
302 48,108
Eric Matyas's avatar
Eric Matyas
Unread hot topic
132 29,608
chadorireborn's avatar
chadorireborn
Unread hot topic
52 8,563
BluePhaze's avatar
BluePhaze