A Second Leap of Faith!

Epic428

  • Posts: 1118
I added in the newest sounds, it is not published yet. I think I like the single switch sound for both types of switches. The way the animations change it just seems to work better.

I really like the platform motion sound, though I am wondering how I can make it a looping sound.

Also, does anyone know of a way to stop individual sounds? Using "Stop All Sounds" would not be Ideal for when I have some BGM.

Also, thanks again for your help KungFuFurby, you are a great asset to this community!
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

KungFuFurby

  • *
  • Posts: 487
I've got some sort of solution for this to stop individual sounds, but the code is quite old (it's not from the Java era, don't worry). Plus, I utilized this for a music segment player that I invented for one of my own games that I never finished (it isn't for Nine Pixel Game 2), and it's a scene behavior.

First, you need a sound attribute. For this case, I'll name it SFX.

Next, make a "When this hears" command, and put in a keyword like "StopSFX".

Now, you need to type in some code. Go under Flow, then Advanced, and you'll find the code snippet. You'll need that, because here's the code that does so (assuming you're using a behavior that says Stop SFX and the sound attribute is SFX):

Code: [Select]
var sound:SoundClip = null
sound = getValueForScene("Stop SFX", "_SFX") as SoundClip;
if (sound != null) {
sound.inst.stop()
}

var sound:SoundClip = null may or may not need to be in its own separate one-line code block depending on what you're using it for. In my case, I separated it.

That's it. It should be good to go... unless for some odd reason my code's too old to work anymore.
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games

Epic428

  • Posts: 1118
Hrmm.. I'll have to take look at that, I'm thinking I could just implement that straight into my "Move Platform" behavior, just to keep it all in one behavior.

I don't plan on having any other looping sounds, aside from the BGM.

Thanks again!
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

KungFuFurby

  • *
  • Posts: 487
You're welcome.
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games

Epic428

  • Posts: 1118
I modified your code KFF so that it works with the behavior, though until the bug I posted gets fixed I won't know if works or not.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

KungFuFurby

  • *
  • Posts: 487
Based on what I see in this bug report (just guessing), it's related to attributes.
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games

Epic428

  • Posts: 1118
Actually, for some reason it has to do with trying to set a sound attribute to an integer. Which tells me that there is an entire piece of code missing.

For example something like: _Sound = getSound(149);

Unfortunately, because I don't know what piece of code is missing, I can't even do it in code mode, because I don't know how I would reference the sound.

http://community.stencyl.com/index.php/topic,386.0.html
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

KungFuFurby

  • *
  • Posts: 487
Oh my... that's a problem. Should I look up your code and see what's going on?
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games

Epic428

  • Posts: 1118
If you think you can solve the issue, then I have no problem with that. I have to update the game on forge though so it contains the latest changes.

I've been sifting through the API and so far I haven't see the right piece of code to put in place. I may just be looking in the wrong classes though.

Edit: uploaded

« Last Edit: April 16, 2011, 09:20:30 am by Epic428 »
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

KungFuFurby

  • *
  • Posts: 487
Well, KungFuFurby is on the job. Good thing I do indeed have experience with programming, because guess what?

Problem solved. It took me a bit, but I cracked it. I originally thought my own code might have been at fault, but I confirmed that it was not at fault once I decided what was going on.

Part of this required me to do this via a single-line code snippet to substitute for the faulty set attribute to sound snippet:
_SFX = getSound(149) instead of _SFX = 149 (somebody should report this bug!)

Directly below this part, I looped the SFX attribute like before.

And as for StopSFX... well, the code was out there, all that was needed was for me to put it in there.

The debugged version is uploaded to StencylForge.
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games

Epic428

  • Posts: 1118
Awesome! LOL I thought that it was supposed to be something like getSound() I just never tried it!

Hahah well, at least it works! Now I just need to make the sound loopable. Currently it fades out and restarts because of the way the sound is. Once that is done, a majority of the sound effects should be in place.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

KungFuFurby

  • *
  • Posts: 487
Just simply modify the MP3 file to snip off that fadeout, unless you want me to do that...
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games

Epic428

  • Posts: 1118
If you wouldn't mind. I have some audio editing programs, but I'm not very fluent with them.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

Epic428

  • Posts: 1118
Hey did you Optimize the game's file size? If so, thank you very much! lol it doesn't work on my computer so it always takes forever to upload to forge.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

KungFuFurby

  • *
  • Posts: 487
I must have unknowingly done that... because I wasn't aware of the original size. Must have been while I was editing...

I actually manually updated my version of StencylWorks to get the job done (considering the fact there's no more automatic update...).

I found a rather serious bug that required me to re-download your game once. De-activating a behavior wiped out those parameters that you set (don't try this: I was trying to transition to code mode by duplicating the behavior and pasting in the code, but changed my mind eventually), and that led to the poor frog getting killed each and every time you had a moving platform there. Thus, I re-downloaded and tried again, seeing I was only trying to fix one thing.

Here's your moving platform, now with no fade. However, I highly doubt this will get through with no delay because of Flash's delay when replaying the sound over and over again.

Moving Platform SFX (no fade out)
http://www.box.net/shared/g75f2mg0xt

« Last Edit: April 16, 2011, 07:28:23 pm by KungFuFurby »
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games