Music won't pause

tswartztswartz Member Posts: 24
I've searched around and haven't found the answer...sorry if I missed it somewhere.

I have my title scene (first scene on game launch) set to play x.aac on loop. I also have buttons that have the following rules:

When pressed / if musplay is true (music is playing) - pause music, set musplay to false, save musplay attribute

When pressed / if musplay is false (music is not playing) - resume music, set musplay to true, save musplay

When you touch the button with the above rule, the music skips for a brief second and then continues playing. The skip tells me that the device registers the button touch and modifies the music, but it certainly isn't pausing the music. Ideas?

I've also tried turning the volume down with the same types of rules...still just a brief skip and then it continues playing.

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    You have a loop there.

    When you press the actor, if the attribute is true, it sets it to false, then the other rule kicks in because it sees that the attribute is false and sets it to true.

    Instead of checking if an attribute is a certain value and then changing it to the opposite value, just change the value when you press the actor.

    Making the attribute an integer instead of a boolean would work better.

    When actor is touched, Change Attribute to (game.Music+1)%2

    If Attribute game.Music = 1, Resume Music
    Otherwise Pause Music
  • tswartztswartz Member Posts: 24
    Didn't expect a yellow box. :D

    Thanks CM - the loop slipped past my tired brain today.
  • MatthewopMatthewop Member Posts: 9
    e.. it should be repaired outside...

    ___________________
Sign In or Register to comment.