Music Problem

triton13triton13 Member Posts: 161
edited March 2012 in Working with GS (Mac)
Hey guys, in my settings, I have a Music Off button. I made a boolean attribute and have this in that button. Rule- Game.Music is true - Rule- Touch is Pressed, change attribute Game.Music to false, pause music, change image to Music On. Under that, I have another rule and it has everything above except Rule- Game.Music is false - Rule- Touch is Pressed, change attribute Game.Music to true, play music, change image to Music Off. When the music is playing and I click Music Off button, it turns it off and changes the image to Music On but when I press Music On, nothing happens.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Dont have it set up like that, do it like this.

    Have a attribute called musicOff and have it set to 0

    In your music off button have a rule when touch is pressed:
    - change attribute musicOff to (musicOff+1)%2

    Then another Rule when attribute musicOff=1:
    -change attribute device music volume to 0
    -change image to music off image
    OTHERWISE
    -change attribute device music volume to 1
    -change image to music on image

    cheers
  • triton13triton13 Member Posts: 161
    Thanks man =)
  • 3xL3xL Member Posts: 676
    yea thats exactly what i did john. i love attributes!
  • CloudsClouds Member Posts: 1,599
    edited March 2012
    Here's a more simple way of doing the very same thing, just one rule, no attributes or 'otherwise' rules.

    When touched:

    change music volume to 1-music volume
    change self.image to 1-self.image

    The all you have to do is name your two button images 1 and 0.


    image



Sign In or Register to comment.