Use 'For Each' Correctly

  • Here's my action

    Start of layout

    For each 'Emitter'

            Play 'audioFile' looping at object 'Emitter'

    This doesn't work when I copy instances of the 'Emitter' object - the sound doesn't emit from each instance, only one or two of them.

    I have an example capx:

    https://dl.dropbox.com/u/3317708/AudioEmitters.capx

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've tried its no luck. Ive tried buttons with two different ID no go it still looping around one of them. I do believe its a bug Your better off getting someone to javacode it or bring it up to construct creator Ive tried function to see if the game would let you since there are multiple of em i tried to set position but apparently the program cannot see multiple set in one action ive tried every thing. it still wanting to go toward one object not multiple.

  • CrudeMik - I'm still learning a great deal here, and audio is definitely NOT my specialty. However, I have just a hunch that part of the deal is because it's all set to On start of layout. Something tells me that's part of the conundrum. While it's working for one emitter, even though you have the For each going, the layout has since already started...come and gone. (The green arrow of the event, as I'm sure you clearly know already, signifies it's waiting for a singular, specific instance of that event...the start. Can't have multiple starts, per se. Certainly not of the layout. ... Er, correct me if I'm wrong.)

    Since it's working for one emitter, I'm guessing you just need to set it up so it's a different event that isn't looking for a one-time occurrence.

    I really don't know, but I hope that helps somehow. Hopefully this will help me learn something, too, once you find the solution.

  • Even if it's a trigger (green arrow) it should work for all objects if you use a "For Each" condition.

    Maybe it's a bug since this was just introduced in the latest beta.

  • Thanks chaps - I'll post this up as a bug

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