How do I play sound of enemy if on screen ?

Get help using Construct 2

Post » Mon Sep 29, 2014 7:43 am

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 :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Mon Sep 29, 2014 8:00 am

try :
if plane is on screen && health = 100,
audio -> play
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
62
S
14
G
2
Posts: 286
Reputation: 6,576

Post » Mon Sep 29, 2014 9:10 am

try this it might help you
You do not have the required permissions to view the files attached to this post.
B
245
S
37
G
15
Posts: 1,940
Reputation: 40,094

Post » Mon Sep 29, 2014 12:21 pm

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 !!!!!!!!!!
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Mon Sep 29, 2014 12:38 pm

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.
Founder of Jadelight Studio, Developer of Libertas Aedifex, regular C2 Help contributor and fan of ambient music and Star Wars.
B
12
S
4
Posts: 255
Reputation: 2,008

Post » Mon Sep 29, 2014 9:00 pm

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

thanks :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Mon Sep 29, 2014 9:50 pm

like this?
(use arrow keys to move enemies offscreen/onscreen)
You do not have the required permissions to view the files attached to this post.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 30, 2014 5:11 am

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
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Tue Sep 30, 2014 5:36 am

...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 :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,860


Return to How do I....?

Who is online

Users browsing this forum: Davlin, Madave96 and 6 guests