Stop sound if actor touched

ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
edited February 2012 in Working with GS (Mac)
Hi guys

I have a pulse actor which pulses with a playing looping sound. Now when the pulse circle is touched another sound is played to show it has been pressed but the original pulse sound effect is still playing.

How do you tell GS to stop playing a sound?

There are lots of things to stop music but not a looping sound effect.

I've even tried turning the sound volume to 0 when actor is pressed but the original 'Play sound' when the scene loads up is still playing

Any clues?

Thanks guys

It takes a Zombie to know a Zombie!!!

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    try this

    make an attribute called stopLoop, make it a boolean and set it to false

    In your play sound behavior, put it in a rule when attribute stopLoop is false

    then when you want that sounds to stop just change attribute stopLoop to true

    cheers
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hi John

    Done that but it doesn't seem to work...?

    Do I put these rules within the actor in GS side window (EDIT MODE) or in the actor on the game screen?

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    edited February 2012
    Not sure what I'm doing wrong here?

    It takes a Zombie to know a Zombie!!!

  • MotherHooseMotherHoose Member Posts: 2,456
    edited February 2012
    on your pulseActor:
    Rule: when
    Event: touch is pressed
    --Play Sound: the other one    √ Run to completion
    Otherwise:
    --Play Sound: the looping one

    @};- MH

    EDIT: the screenshots are too small to read
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    No, that doesn't work neither...the original pulse sound effect is still playing even when the pulse actor is pressed and the new pulse effect is played.

    The trouble is he original sound effect is on a loop and it just keeps on playing, even if I put a rule in to say 'stoploop' is true

    It takes a Zombie to know a Zombie!!!

  • MotherHooseMotherHoose Member Posts: 2,456
    edited February 2012
    are they both the sounds imported as sounds? or music? or one of each?

    if one is music:
    on your pulseActor:
    Play Music … select the musicFile √ Loop
    Rule: when
    Event: touch is pressed
    --Pause Music behavior
    --Play Sound
    -Otherwise:
    --Play Music … select the musicFile √ Loop

    @};- MH
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    their both imported as sounds...ah question.

    What would happen if I import the sound again as 'Music' How does GS deal with the difference.

    If I import as 'Music' then I can use the STOPMUSIC attribute....would that work?

    Thanks for the help MH...appreciate it and sorry to be a numpty! :)

    It takes a Zombie to know a Zombie!!!

  • MotherHooseMotherHoose Member Posts: 2,456
    edited February 2012
    musicFiles are more performance intense … so use sound when you can

    okay how long does the newPulse effect play?

    you may need a Timer in the Otherwise:

    Timer: After: duration of the newPulse sound seconds
    -Play Sound: select the sound and loop

    clicking 'Get Info' on the soundFile in Finder will show you the duration
    ===
    Stop Music will work but if you restart it is at beginning of the track

    @};- MH
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Thanks Motherhoose

    I will try that and see if it works...
    Thanks for your time and advice :)

    It takes a Zombie to know a Zombie!!!

Sign In or Register to comment.