How can the music plays continuously?

0 favourites
  • 8 posts
From the Asset Store
In this template the music plays without looping in your game
  • Hello I make a Game with Construct 3 and I want that the Music plays continuously even when the layout restarts. Every Level has its own Music.

    How can I make this?

  • I'm assuming that you are using an event on start of layout to play the music?

    If so add another condition that is "yourmusicfile" Is not playing.

    This means that if the music is playing and the layout restarts, the song will not start again but will continue from where it was.

  • My Game have checkpoints that save the game. When the player hits a saw or something else than you restart at the last checkpoint. This is made with: Load game from file. My Music starts with: On Start of Layout Audio Stop All and Play Musicfile. And when you restart at the checkpoint it is: On Load Complete Audio Stop All and Play Musicfile.

  • Just remove the stop and play actions from load checkpoint logic then and the music will continue to play.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But every level have its own music. When I remove the stop all then the music from the other level will play in the next level and the music of the level^^ This means 2 music files will play at the same time. I want that the music plays all the time even when you restart at the checkpoint.

  • And when I just say On Start of Layout Stop all Music and play Musicfile. Then the music will continue at the checkpoint. But when you close the game and open it again and click in the title screen the Load Game Button, then the last checkpoint will be loaded but the music is not there. There is no music.

  • Hello! I have a similar issue but I didn't want to open a new topic, so I'll explain here.

    Basically, the player can restart the layout whenever they want, to keep it easy to try again. However, the selected music for that layout won't stop restarting.

    I did get an idea of what calminthenight said, but I don't know exactly how to execute it through the events.

    ^^^^

    This is basically what I wanted to say. Here below I am about to give extra thoughts.

    I guess the game should recognize that the game has already the music played. I guess one possible way to do this is through global variables, although there is an issue with the audio tag.

    On start Layout > Set Global.MusicPlaying to music.mp3
    			> Play Global.MusicPlaying looping from Music at 0db (tag "music")
    
    Global.MusicPlaying = music.mp3 > ???
    

    I could use the "Set Paused" event in the state of "Resume", but it requires the audio tag ("music"), which, by restarting the layout, gets removed and added once the layout starts again. Meaning, I doubt it's the solution.

    Let me know in the comments, I'm super open to suggestions! Thank you so much!

  • Oh my gosh. I think I did it...!

    By reading a second time what calminthenight said, I noticed I made a mistake.

    The two conditions must align in the same event, and not in two.

    On Start Layout
    Global.MusicPlaying = Music.mp3 > Set Global.MusicPlaying to Music.mp3
    				> Play Global.MusicPlaying looping from Music at db (tag "music")
    
    

    Before that I had the two conditions I thought I had to search for a specific event action that would have helped me to "resume" the music. But this event is clearer and better. Nice!

    I hope this helps someone.

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