Sounds Effects Break the Music [Solved]

Edge123

  • Posts: 57
So I figured out that when I use a sound effect in a level, sometimes the music won't reload on creation of the scene if the player dies so it will just stay silent. When I remove the sound effect from the level, if the player dies, it will 100% of the time reload the music successfully. Is there something wrong with my sound effect file or could it be something else?

« Last Edit: September 16, 2019, 03:51:16 pm by Edge123 »

Luyren

  • *
  • Posts: 1798
Post your sound effect and soundtrack codes.
I have my Stencyl resources available here: https://luyren.itch.io/

Edge123

  • Posts: 57
I attached the sound effect I am using. As for the code:

https://imgur.com/a/h1IuB9X
This is for when the player touches the banana

https://imgur.com/a/vj38RIY
This is for when the player dies from touching the spikes

https://imgur.com/a/rDzcDqX
This is when the level is created

Luyren

  • *
  • Posts: 1798
On your "self hits spikes" code, I think what's happening is that code is executing multiple times, every frame that those two actors are colliding. My hypothesis is that that is causing the fade sound block's effect to execute after the scene loads.

Add a boolean on that code (if <not boolean>, set boolean to true, execute your fade out and scene transition code) and see if that fixes it for you.
I have my Stencyl resources available here: https://luyren.itch.io/

Edge123

  • Posts: 57
It still seems to only sometimes work for music to start up  :-\

Luyren

  • *
  • Posts: 1798
Another suggestion is to use the "play sound on sound channel" and "fade out sound channel" blocks, and dedicate one sound channel specifically for the soundtrack of your game. That way the sound effects shouldn't interfere with the soundtrack.
I have my Stencyl resources available here: https://luyren.itch.io/

Edge123

  • Posts: 57
So I did use the channel block but now the music never starts up. Is it possible my sound effect file is corrupt or is there more to it?

JeffreyDriver

  • *
  • Posts: 2151
I always put my music on channel 30 to prevent there being any conflicts. I let sound effects just play on any available channel.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

Luyren

  • *
  • Posts: 1798
So I did use the channel block but now the music never starts up. Is it possible my sound effect file is corrupt or is there more to it?
Try using "fade in sound on channel X" on your created code to play the soundtrack, instead of setting the volume to 100.
I have my Stencyl resources available here: https://luyren.itch.io/

Edge123

  • Posts: 57
Using the Fade In on channel x block actually works! Thank you for solving a problem that bugged me for a long time.