ViliamVadocz's Forum Posts

  • 2 posts
  • I didn't realise there was a "pick all instances of an object" event. Why is it in system though? Shouldn't it be in the object category, for example as "pick by UID" is?

    Anyway, I was inspired and looked more into logic and found a much easier way of doing it:

      Is "Object" on-screen \/
        Tag "Sound" isn't playing -> Play "Sound"
      Else -> Stop "Sound"

    This seems to work. Thanks for the help anyway!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm making a game and I want audio to play when there is at least one instance of an object on-screen. If there isn't, I want to turn it off.

    I've tried many things*, but currently I've resorted to making an instance variable 'OnScreen' and then, every tick, I make it so each instance either has 1 or 0, depending on whether they are on-screen. Then, I check whether an instance has 'OnScreen' = 1 and whether the sound isn't playing yet. If that's true, I play the sound.

    To turn it off, I look up the nearest instance (to player) and whether it has 'OnScreen' = 0 and then I turn off the sound.

    This works, but sometimes the closest instance isn't on screen, while a more further away instance is. There is no sound, even though I want there to be.

    I would love it if there would be some way to check whether there is any instance on-screen. Thanks for any help in advance!

    *I can't just simply check whether an instance is on-screen, because some are and some aren't. I want the sound to turn on even when not all are on screen, but at least one is.

  • 2 posts