Sounds Effects Break the Music [Solved]

Edge123

  • Posts: 62
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: 2388
Post your sound effect and soundtrack codes.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Edge123

  • Posts: 62
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: 2388
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.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Edge123

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

Luyren

  • *
  • Posts: 2388
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.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Edge123

  • Posts: 62
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: 2262
I always put my music on channel 30 to prevent there being any conflicts. I let sound effects just play on any available channel.

Luyren

  • *
  • Posts: 2388
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.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Edge123

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