Help with Turning Music ON and OFF

mortbrewmortbrew Member Posts: 3
I have a game attribute called "Music" that should control if music is playing or not.
Default is set to "1" to make the music play.
Setting the attribute to "1" should cause all game music to play.
Setting the attribute to "0" should cause all game music to not play.
image
I have set my rules for both the ON and OFF button.
image
image
image
My problem is that I can click the OFF button once and everything works but I cannot then immediately click the ON button and revert back to ON. If I change scenes and come back to here I can then click the ON button and revert back to ON but again I have to change scenes to click the OFF button. What am I doing wrong? I have viewed the tShirtBooth video on making an ON/OFF button, but I wanted to do it this way. Is this possible? Thank you for time reading this! :0)

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Since you are using two buttons Try getting rid of the rules if music = 0 or 1 and just put

    If touch is released
    Change attribute to 0
  • mortbrewmortbrew Member Posts: 3
    Thanks for your quick reply @jonmulcahy! This problem really has me stumped. I removed the rules that set the actor image based on the value of the "Music" attribute. That didn't work. It's almost as if the attribute can only be updated once per scene. I have linked the project if anyone wants to have a crack at it. Thanks GS community!

    http://dl.dropbox.com/u/890/Starburst/StarBurst.gameproj.zip
  • mortbrewmortbrew Member Posts: 3
    I fixed it! Hopefully someone else can learn from my mistake. The only thing I changed was to not just set the attribute value in the inspector, but also setting my "Music" button to do what is in the picture. The key it seems to me is setting the value of the attribute with an actor initially and not just relying on the Inspector value. Works like a charm!

    image
Sign In or Register to comment.