How do I

0 favourites
  • 10 posts
  • I have a few levels in my game now. I am trying to have several different background music, a different one for each level.

    level 1 layout starts play background 1.....

    level 2 layout starts play background 2...

    the issue I am having is when the player dies or respawns by leaving the playing area the looping sound that I have starting upon layout out doubles, its like playing over itself...

  • You could just set it so that every time it starts have a stop music then under it have a start music action. That way the music is always stopped every time it starts again.

  • when the player its out of layout it restarts the layout....i tried to do a ..when player is out of layout stop music but it doesnt listen to it....it just doubles. it

  • not sure why the song doubles when layout starts back up

  • Where is the layout restart placed?? I don't see it in your screenshot I only see when out of layout to stop the sound. But what you can do is when the layout starts check if the theme is playing ..if so stop it..then restart it. But depending on where you put the layout restart it could be happening before it gets to the event of stopping the music. So you have to have the music stop event before the layout restart.

  • aw ok, yea the layout restart is at the beginning of the event page.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • would i be using an if statement? not sure how to check if its playing?

  • You are trying to stop something that is not there. In the "Stop audio" or what its called it ask for a tag, at the moment your tag is "". So for the background music just add a tag, can be whatever you want it to. And in the "Stop audio" you write this tag instead of the audiofilename and then it works.

  • At the top you should have your on layout start so it should be

    on layout start->(subevent)Audio is playing (Audio Tag)->(Action)Audio Stop(AUDIO Tag)

    That has to be before the play audio and the way to but it at the bottom of the on layout start event is create a blank subevent below it

    Also as a side note::

    Just sharing a personal preference The 'On Start of Layout' should be the first event in a eventsheet; IMO because everything executes in order that you have it setup. So nothing should be running before 'On Start of Layout'. Events should be place in level of importance and being that 'On Start of Layout' setup the level it should be number#1

  • ]it works, thanks for your help...now its time to figure out how to have each layout play its own unique song.

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