Music changing problems

  • Hiya folks, new to the forum, been making a game with C2 for about a year now, but I've run into an issue that I just can't seem to fix, and Google's not helping this time!

    This is what happens: At the start of my level, I play a tagged, looping music file (.ogg, from the Music folder); it plays and loops just fine. All good. But when I want to stop that music and play different music, it won't work. I can stop the original music via a tag just fine. But nothing else from the Music folder will play afterwards. This seems like such a simple thing - all I want to do is stop one track and play another instead! Am I missing something? I'm going bananas. In this instance I want to stop the level bgm and play the death music when the player dies. Even if I stop the first music on the first layout, go to the death screen layout, and then try to play the death music like 30 seconds later, it still won't work. I did some tests and it's not that C2 is playing the death music silently or anything like that (playback timer stays at 0). It just isn't playing it. Argh!!

    If I put all the music into the Sounds folder, then it works the way I want, except there is like a ~20 second delay at the start of the level with no music while it loads everything! Yuck.

    So, any ideas? Why wouldn't Construct 2 play a music file after another one has been stopped? Any ideas? Please help

  • you can try:

    on death event:

    • preload "death song"
    • other thing you must do
    • go to layout "death"
    • stop play "music"

    on "death" layout start: start playing "death song"

    or you can try the plugin [sound]Fade-in/Fade-out by rexrainbow and fade out your song and fade in the death song at the same time

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, I've done more testing and the plot thickens. If I replace the first music with a different .ogg file then everything works just fine. So I thought that maybe there was just something messed up about that file. Except if I put the files the other way round as a test - ie, play the death music during the level, and play the level music on death - that .ogg causes no problems. It seems as if that one specific file causes a problem used in that one specific way??

    That'd be okay - I can just not use that file that way - but I've only just started adding music to my game and I'm a bit worried I'm going to run into this issue again, and I'd like to understand how it happens. Has this happened to anyone else??

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)