Music without interruption?

0 favourites
  • 5 posts
From the Asset Store
In this template the music plays without looping in your game
  • Is there any way to keep the background music playing all the time..? I mean, that I have a project which restarts the layout whenever player misses the target and when player hits target, it goes to next layout.. I would like the music to play without interruptions between layouts and/or restarts..


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • chef,

    You can use a global variable (musicOn) for this. Just set an event on start of layout to check this variable. If it's 0, then start the music (and set musicOn to 1).

    Copy the event to every layout (or put it on a global event sheet), and once you've started the music it will just keep playing. Each time you go between layouts or restart a layout, it will check to see if music is already playing, and take appropriate action.

    Edit: Don't forget to reset musicOn to 0 when you finally turn the music off though!

    Hope that helps :)

  • Ah, yes.. simple as always! Thank you!

  • Blacksmith

    Hmm.. well it wasn't so simple or I'm doing it wrong..

    <img src="" border="0" />

    This still starts the song from the beginning when the layout restarts or a new layout starts..

  • Hi chef,

    I've made a simple example of what I was suggesting. You were on the right track, just needed a few minor changes :)

    The red button switches between layouts, and the blue button stops the music. You'll notice that when you switch between layouts, the music continues to play without stopping then restarting (because of our variable check)! However turning off the music, sets the variable back to 0, so when you switch to another layout, the music will restart again!


    Music was supplied by tulamide :) You can find more free music by tulamide here.

    Hope that makes things a little clearer :)

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