[RESOLVED] Overlapping music issue

From the Asset Store
Pathfinding AI
$2 USD
80% off
Units do not overlap each other and use different ways if there are several free ways.

    Hello,

    I am having a problem with overlapping music when returning too quickly from another layout.

    I am currently working with Construct 2 on my project.

    But to check if I was doing something wrong, I also tried to make a simple project in both Construct 2 and Construct 3. And I am getting different results depending on the origin of the file.

    So what I would like to know, if I am actually using events wrongly, no matter which engine version I use

    Basically I made 3 tests (same events, same assets):

    1. 1 test in Construct 2
    2. 1 test in Construct 3
    3. 1 test imported from construct 2 into 3

    I'm planning to move to Construct 3 in near future, but it's important for me to make sure that it's going to work given the situation.

    1. Construct 2 file: music overlaps when returning quickly from level 1 to menu
    2. Construct 3 file: music never overlaps
    3. Imported file: music overlaps when returning quickly from level 1 to menu

    1. Given the different results I am wondering why this is happening.

    2. Obviously I am wondering when I'll switch to Construct 3 if I'm still going to experience the same issue

    3. How can I fix it so when I import my project from Construct 2 to 3 it will work.

    Below screenshot of the events taken in Construct 3 (3 event sheets, 2 layouts):

    Thanks a lot for your help!

    Use tags! Check if tag "music" is not already playing, only then start playing music with tag "music".

    Hey, thanks, I'll give it a try with a quick test :)

    I'll do a test at lunch actually if I have enough time since I'm at work :)

    What I noticed though is that I only get the issue if I use the "choose" expression to select randomly one of the 4 music. It does not happen if I pick a music at the start of the layout. Maybe it gets executed after the layout ends?

    Anyway I'll make the test properly with "choose" and "tags" to see if that solve my issue :)

    Thanks again.

    So I have made a test in Construct 2 and imported the file in Construct 3.

    These are my events:

    So I am only using the tag "MusicLevel" in the menu layout for test purpose.

    1. If I use Construct 2 runtime, I still get the bug.
    2. If I use Construct 3 runtime, I don't.

    Do I need to switch now to Construct 3 and will this not happen when updating my projectt, that's what i am wondering?

    Also when switching to Construct 2, should I delete all my events, and "rewrite" them or it is exactly saved the same way so pointless?

    Thanks!

    Use tags! Check if tag "music" is not already playing, only then start playing music with tag "music".

    Hopefully I managed to do what you meant in the test above, else I'll be grateful if you could show me :)

    Ok after trying different solutions, I found my mistake:

    I was playing a Music from the Sounds folder rather than Music folder. It still found the music, and started playing after a delay rather than not working. Because of that I thought I was using the event correctly.

    I have changed to Music, and now music plays instantly and stops when I ask it to.

    So it is resolved :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    It don't think there is any difference between C2 to C3 here, and the runtime should also not matter.

    I don't understand - you want to play Music1/Music2/Music3/Music4 in levels, and when switching to Menu you want to stop level music and play MusicMenu? When switching to level, you want to stop menu music? Or when any music is already playing, you don't want to interrupt it?

    you want to play Music1/Music2/Music3/Music4 in levels, and when switching to Menu you want to stop level music and play MusicMenu? When switching to level, you want to stop menu music?

    Yes that's correct. I'm currently using 5 different music in the game (which is actually a game for little children).

    Basically the idea is that every time I start a new game, I randomly pick a different music, and when I go back to the menu I always use the same music.So I have different situations:

    - Some games break down into levels and use different layouts. When the "level" is completed, a new layout is loaded, but the music is uninterrupted. You have to keep in mind that a level can be completed in 15-60 seconds depending on the age of the child. If the player goes back to the menu, the music ends and the music from the menu kicks in.

    - From the menu, you can go into sub-menus, which loads different layouts depending on the type of "game" picked. Because it's possible to go back and forth (from menu to sub-menu and vice-versa) without playing anything, I don't want to stop the music, so it remains uninterrupted.

    It's all fixed, I have tested it thoroughly, it was obviously my mistake.

    As you said the runtime, here did not make any difference in the end. It's only because I used the same file from C2 into C3 which was using the wrong folder, while the file I made in C3 was using the correct one. Hence the difference.

    As for the tags, I have learnt something new :)

    Ok, so in this case I would use two tags - "MenuMusic" and "LevelMusic". Level music are random tracks, but played with the same tag.

    On start of menu layout, stop tag "LevelMusic" and start "MenuMusic".

    On start of any level, stop tag "MenuMusic", and start "LevelMusic". (only if this tag is not playing already)

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