How do i start and stop a music when i leave a layout.

  • I am making a space shooter game but i ran into an issue.

    Every layout in my game has its own music and i want when i leave the layout the music stops and when i come back the music starts playing again.

    example: Title Screen has its own music, stage selection has its own music and every individual stage has its own music.

    please, how do i implement this in my game?

  • On start of layout - start music

    Whatever event has the action to change layouts, add an additional action to stop music.

  • Hi oosyrag for responding to post.

    I tried your suggestion but it didn't work.

    Here is what my workflow looks like.

  • On each of your play and exit controls, before the System>go to layout - you can just add an action for the audio plugin to stop - and then put in the tag you want to stop, so in this case stop "game action" it will stop the audio, so in the next layout on start of layout you can put in another audio action to start the relevant audio for that layout.

  • Thanks signaljacker for your contribution but unfortunately it did not work. when i go to any other layout the music stops but when i return back to layout with the screenshot above the music does not play.

    I have been at this for four days now.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • https://www.dropbox.com/s/9xiagn43k8po3 ... .capx?dl=0

    Are you sure your layouts are linked to the correct event sheets? Also try removing/disabling the second condition "Is not playing" and see if it makes a difference. Also make sure the "stop music" action happens before you actually change layouts.

  • Hi oosyrag thanks for always responding to my posts.

    I downloaded your capx but it was too complicated for me to understand as i am still a newbie with a burning desire to publish my first real game.

    please give me your emeail so i can send you my capx file as i do not want to leave this project i the open due to the fact that i have spent money acquiring the assets.

  • Don't worry about the doorevents sheet, there are literally only 2 events of interest to you per layout - On start of layout, play music, and on exit stop music. That is all there is to it.

  • i did that but it still does not work .

    Maybe i need to uninstall my copy of construct 2 and reinstall it.

    I will update you later if i get it to work otherwise i might just send the capx file.

    Thank you so much for responding fast.

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