Sound cutting out after "X" time - Fixed!!

Hello,

This was a big issue for me and I fixed it :) So I thought I'd share what I did.

1.) Create a new attribute (Interger) and name it whatever you want. I used SFX - PUNCH
2.) On the enemy create a rule that says | When Touch is pressed | Change Attribute | game.SFX - Punch to 1 |
3.) On the "otherwise" section of the enemy put the same code as #2 but make it change to 0
4.) On the map or level create a rule that says | When game.SFX - Punch = 1 | Play "Your Sound"

Since I've done it this way, I have yet to experience the SFX cut out issue :)

photo ScreenShot2013-10-03at64729PM_zps31b887c8.png

Comments

  • DaveGWelshDaveGWelsh Member Posts: 60
    Awesome. Thank you!!!! I'm going to try this later. This has been a huge problem for me!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Just so you're aware, this is not a problem related to sounds but actually a problem with the way you initially coded your rules.

    When a rule is triggered, it runs its behaviors while the rule condition is true. So if you use a When Touch is Pressed condtiion, the sound will only play when the mouse/tap is still held down. If you release the touch, the rule condition is false and the associated behaviors stop running. This is actually the point of the Run to Completion checkbox in the Timer behavior. If that box is checked, the timer continues to run even if the rule condition changes. Because most behaviors do not have that checkbox, it's necessary to program in a way to complete the behavior(s). You found one way: to change an attribute (could be boolean or integer, for example) and have a rule that checks the value of that attribute. Since the attribute changes as soon as the touch is registered, the sound will continue to play until the value of that attribute changes again or the sound is finished. This is because that rule (e.g. When attribute game.SFX - Punch = 1) continues to be true instead of changing when touch is released.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • DaveGWelshDaveGWelsh Member Posts: 60
    Do you think the sound issue will be addressed soon?
Sign In or Register to comment.