How do I stop only objects sound?

Get help using Construct 2

Post » Thu Apr 27, 2017 4:06 pm

There is a button that spawns an object, once the object is spawned it plays a looping sound "Rain".
Once i double click the object, it gets destroyed and stops "Rain" sound with it.
But there are multiple of same objects on the screen and i don't want all "Rain" sounds to be stopped.
How do i fix this?

RainCloud - On Created - Play sound Rain
RainCloud - On Destroyed - Stop Rain sound
B
6
S
1
Posts: 4
Reputation: 468

Post » Thu Apr 27, 2017 4:07 pm

have a variable for each one maybe or an array or instance variable
Image
B
29
S
15
G
12
Posts: 312
Reputation: 9,664

Post » Thu Apr 27, 2017 4:32 pm

@EDplus

When you play a sound, there is an option for a Tag, set that to the RainCloud's UID which is unique to that object, then stop the sound using that Tag.

RainCloud - On Created - Play sound Rain, Tag = RainCloud.UID
RainCloud - On Destroyed - Stop sound, Tag = RainCloud.UID
Find all the Construct 2 games that were on Steam Greenlight here
B
35
S
9
G
7
Posts: 468
Reputation: 6,866

Post » Thu Apr 27, 2017 4:48 pm

Fixed this by doing:
RainCloud - On Created - Play sound Rain, Tag = RainCloud.UID&"Rain"
RainCloud - On Destroyed - Stop sound, Tag = RainCloud.UID&"Rain"
B
6
S
1
Posts: 4
Reputation: 468


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 14 guests