Backgroundmusic should loop - if user wants it. How???

akimannakimann Member Posts: 62
edited November -1 in Working with GS (Mac)
Hi folks,

just one question: I want to make a button like "music loop/no loop". But I have no idea how I could manage this with the "play music"-option. Is it possible to check/uncheck the "loop"-option in "Play Music" via an attribute?

Comments

  • sparkzillasparkzilla Member Posts: 152
    Use the mod function to make a toggle switch, then make a rule to play or pause music based on the result of the toggle.

    Make an integer attribute. game.Music

    When you press the mouse button, or touch(pressed) the actor:

    Change Attribute: game.Music = (game.Music + 1)%2
    So the value of Music is either 0 or 1. You can check for those values in the rule.

    when game.Switch =1
    Stop Music
    Otherwise
    Play Music
  • akimannakimann Member Posts: 62
    Hi Sparkzilla,

    thank you for your help, but I thought about something different. Imagine you have a 1min Soundfile. This Soundfile should repeat from the beginning, when it reached the end AND when the user choosed that this sound file should be looped. So when "loop" is checked it will play again and again and again and.....

    Sorry about my bad english (come from germany) but I hope you know what I mean :-)
Sign In or Register to comment.