Help removing a sound loop created based on [On Created]sprite

  • Hi

    This is hopefully a simple issue for someone glimpsing past my post.

    So I have a sound file imported named Growl.

    A sprite named Breathe is continuously created and disappears after its two frames are finished.

    What I've done is this:

    ----+ Breathe: On created

    --------+ System: Trigger once

    ---------> Audio: Play Growl not looping at volume 0 dB (tag "")

    All is nice and dandy. But if another Breathe sprite is created while one already exists, the sound seem to loop until both instances are gone.

    How do I prevent this loop from occuring? The System: Trigger once, only prevents one sound alone from looping.

  • Are you sure that's what happens because I would expect it to play once on sprite created. You also don't need a trigger once because 'on created' is a trigger event that automatically triggers once only.

  • As mentioned, if I was to ensure only one Breathe sprite exists at one time and also remove the Trigger Once sub-event, the Growl sound loops until the Breathe sprite disappears.

    I'm not sure what I'm doing wrong. Otherwise it's the preview function that messes the sound up, but I wouldn't know.

  • You said the enemy is continuously created? Do you have other events relating the audio? Lets see a screenshot of the event so I can view the structure.

  • [Beast]

    ----+ Beast: On animation "Idle" finished

    -----> Beast: Set animation to "Ready" (play from beginning)

    ----+ Beast: On animation "Ready" finished

    -----> Beast: Set animation to "Idle" (play from beginning)

    ----+ Beast: Animation frame = 3

    ----+ Beast: Is animation "Ready" playing

    --------+ System: For each Beast

    ---------> System: Create object Breathe on layer 5 at (Beast.BBoxRight +5, Beast.BBoxBottom +10)

    ----+ Breathe: On any animation finished

    -----> Breathe: Destroy

    And the creation of Breathe plays the sound growl.

    That's all the other code somehow involved with the playing of the audio file.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • [Beast]

    ----+ Beast: On animation "Idle" finished

    -----> Beast: Set animation to "Ready" (play from beginning)

    ----+ Beast: On animation "Ready" finished

    -----> Beast: Set animation to "Idle" (play from beginning)

    ----+ Beast: Animation frame = 3

    ----+ Beast: Is animation "Ready" playing

    --------+ System: For each Beast

    ---------> System: Create object Breathe on layer 5 at (Beast.BBoxRight +5, Beast.BBoxBottom +10)

    ----+ Breathe: On any animation finished

    -----> Breathe: Destroy

    And the creation of Breathe plays the sound growl.

    That's all the other code somehow involved with the playing of the audio file.

    You could make an duct tape code to end him. just stop it after a time. Like: After XX seconds, stop audio, could solve it until you find the real solution.

  • DogeDev

    That could be a temporal solution, though I've found another fix for now. I edited the event instead to play the sound during the third frame of the Beast Ready Animation. That doesn't seem to cause a problem. Still need that Trigger Once sub-event to not cause looping.

  • Are you certain it's creating breathe objects as expected? The logic looks a bit off maybe but I can't tell easily from the text. Check in debug view, is it just creating the breathe object every tick? That would make it seem like the music is constantly looping.

  • Holy cow! It seems something is constantly spitting out Breathe sprites!

    Thanks for telling me to go debug! I've never used it until now.

  • Ya your for each is in the wrong place, should be on the top level of the event, for each breathe, anim frame=3

  • I see I see.

    Thanks for the help. You revealed much more than I imagined!

    I placed a Trigger once sub-event for the third animation frame before the For Each sub-event. It seemed to stop the sprite spam.

    I'll keep your top level advice in mind. Sounds like a better practice.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)