stop music at the end of a layout ?

Get help using Construct 2

Post » Tue Jun 12, 2012 10:44 pm

can start it ... cant stop it ..
every layer has a different soundtrack so it just sounds horrible
B
16
S
4
G
4
Posts: 179
Reputation: 4,688

Post » Wed Jun 13, 2012 1:09 am

Use the event condition "On end of layout" and apply the action "Audio: Stop" and give the tag to the music playing.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Wed Jun 13, 2012 2:33 am

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

PlayStopMusic.capx
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Wed Jun 13, 2012 9:45 am

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
B
16
S
4
G
4
Posts: 179
Reputation: 4,688

Post » Wed Jun 13, 2012 10:17 am

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 https://dl.dropbox.com/u/84483952/Milk%20of%20Ultra%20Violet.capxrailslave2012-06-13 10:52:35
B
16
S
4
G
4
Posts: 179
Reputation: 4,688

Post » Wed Jun 13, 2012 4:17 pm

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.
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Wed Jun 13, 2012 6:29 pm

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 :)
https://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 railslave2012-06-13 19:11:35
B
16
S
4
G
4
Posts: 179
Reputation: 4,688

Post » Thu Jun 14, 2012 2:34 am

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.

B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Thu Jun 14, 2012 4:34 am

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.
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Thu Jun 14, 2012 1:45 pm

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
B
16
S
4
G
4
Posts: 179
Reputation: 4,688

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Televangelist and 27 guests