How do I play sound of enemy if on screen ?

  • Hi guys, I tried so many options...but nothing is really working

    I have a long vertical layout...where every 3 seconds a plane is created...

    I would like to her the engine sound only if the plane is visible on screen...and stop the sound if a plane is destroyed.

    How can I mange that ?

    I tried if enemy is on screen play sound ...some how it is ehm...just ok..strangely the sound seems with reverbero...and anyway I did not manage to stop imedeiatelly the sound after the distruction of the enemy....

    other thing: can I play only one sound if there are more enemies ???

    please help

  • try :

    if plane is on screen && health = 100,

    audio -> play

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • try this it might help you

  • thanks all...

    can I do that also without health somehow ?

    thanks , but the capx for me was not what I need...infact if I move the plane far away...still there is sound even the plane is still not visible...I need a sound ONLY when the enemy is visible....

    What can I by the way do if there 5 ebemies, but I do not want 5 sounds all together ?

    thanks guys !!!!!!!!!!

  • To play it once only you'll need a variable you can toggle on and off. Create it initially set to 0 and where the sound plays, check if it is equal to 0. Inside that, add System -> Set value 1. Add an else to your main check and then add the sound object to stop the sound with the tag you've called.

  • ...thanks...is there a sample capx for palying if enemy is on screen ?

    thanks

  • like this?

    (use arrow keys to move enemies offscreen/onscreen)

  • super kind and super help thanks a lot.

    maaan.. I am using C2 several weeks...and still I have logical problems for solving a few problems...

    thanks a lot

  • ...ehm just a other small question...can I stop and beginn 1 second after and befor comparing on screen? ...it sounds a bit strange if a Helicopter finishes the be heard suddenly ... or maybe fading in and fading out ?

    thanks

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