How to turn off all music in whole app

I was wondering how I would make a button the would turn off all music in the entire app until the button is pushed again. I would need to be on stop music from playing on all pages. If you want I can upload the app file.

I would love any help I could get.

Thanks
Conner

Comments

  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    In this method I'm going to tell u how to do it so once the button is pressed again to turn music on. The music won't start from the start again.

    Make a boolean attribute called "button" and leave it on true "unticked"


    Make the button for music on the main menu:
    In this button make:
    Rule > touch is pressed
    And attribute "button" =true
    Change attribute "button" to false

    Otherwise:
    Rule > touch is pressed
    And attribute "button" = false
    Change attribute "button" to true

    Now when your going to make a play music or play sound behaviour in a scene. Any scene it must be as follows:

    In the actor the music plays in:
    Rule> if attribute button=true
    Play sound or music.
    With a volume of 1

    Otherwise
    Rule> if attribute button =false
    Play sound or music
    With a volume of o


    Hope this helps
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    All you need it make a button with a rule

    When touch is pressed
    -- change attribute game.musicvolume to (game.musicvolume+1)%2

    It will switch the music volume between 1 and 0 each time it's pushed

    Then you can set a music on and music off image based on the music volume attribute.

    That should also remove the need to set a value or rules for each scene.
  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    @tenrdrmer wow thats so much easier :/ i feel dumb
  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2013
    When touch is pressed
    -- change attribute game.musicvolume to (game.musicvolume+1)%2

    It will switch the music volume between 1 and 0 each time it's pushed
    @tenrdrmer

    Even simpler: game.musicvolume to 1-game.musicvolume

  • BIG_THINKIN_APPSBIG_THINKIN_APPS Member Posts: 944
    I am confused about how to do all this, I think the way that I did the music it does not work, I am sorry about this. Thanks for you help.

    If any one wants to take a look at the GS file.

    https://www.dropbox.com/s/btan7ofh6682nt9/FindingAFamily.gameproj.zip

    Thanks for all your help so far,
    Conner
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    @socks I think your method is equally as easy but no where near as sexy looking. I mean who honestly would want to pass up the chance to use a % in there expressions.
  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2013
    @socks I think your method is equally as easy but no where near as sexy looking. I mean who honestly would want to pass up the chance to use a % in there expressions.
    @tenrdrmer

    Yours may be sexier, but when I typed out my solution I was in a leopard skin dressing gown listening to Barry White's greatest hits whilst applying the last of a 2 litre bottle of medium quality 'musk and barbecue' cologne.
  • POMPOM Member Posts: 2,599
    Lol you guys are funny
  • quantumsheepquantumsheep Member Posts: 8,188
    @socks I think your method is equally as easy but no where near as sexy looking. I mean who honestly would want to pass up the chance to use a % in there expressions.
    @tenrdrmer

    Yours may be sexier, but when I typed out my solution I was in a leopard skin dressing gown listening to Barry White's greatest hits whilst applying the last of a 2 litre bottle of medium quality 'musk and barbecue' cologne.
    I'm scared.

    Scared that I'm slightly aroused.

    *runs a cold shower*

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • SocksSocks London, UK.Member Posts: 12,822
    I'm scared.

    Scared that I'm slightly aroused.

    *runs a cold shower*
    I'm selling 30" x 24" posters, PM me, I'll cut you a deal.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    By the way it's prob better to use the modulo function from the drop down list rather than use a % sign. As not all formats will understand it properly. E.g html5. That 's what Bob at helpdesk told me anyway.
  • allc1865allc1865 Member, PRO Posts: 777
    edited November 2013
    What you want to do is put the music on the screen that's not going to be viewed but only once, for instance your logo page. Don't place the music on your splash screen.
    Make an integer attribute called "music". Keep it at 0.
    Place the Play Music behavior on the background that will only be viewed once > select your song.
    Go into your Music On actor > create a rule > when touch pressed > change attribute > (game.music+1)%2
    Create another rule that says when > attribute > game.music = 0 > change attribute > game.Audio.music volume to 1
    change image (if you have one) to your music on image > otherwise > change image to your music off image > change attribute > game.Audio.Music Volume to 0.


    That should work. Ask if you have any more questions... ;)
Sign In or Register to comment.