How to turn off all music in whole app
BIG_THINKIN_APPS
Member Posts: 944
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
I would love any help I could get.
Thanks
Conner
Comments
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
GSINVENTION FREE TEMPLATES
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.
GSINVENTION FREE TEMPLATES
Even simpler: game.musicvolume to 1-game.musicvolume
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
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.
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
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...