How do I destroy enemy from the family

Get help using Construct 2

Post » Sun May 15, 2016 8:40 am

Hi everyone.
I've made a family where I've added 2 enemies and later maybe I would add more of them.
The problem is when I destroy one enemy in that family all of them are spawning an effect: ("Enemy_Air_Parts_Spawn") - so this function seems to be called for all of them, and I want to call it just for the one that is destroyed, of course. Do you know what I have to add or modify to make it work ?

https://www.dropbox.com/s/qypw97wb7wmkt ... m.jpg?dl=0
B
36
S
10
G
9
Posts: 212
Reputation: 6,945

Post » Sun May 15, 2016 9:26 am

Hi anty,

this happens since you do not pick any specific instance when calling your function.

You may try to hand over the Enemys_Air_test.UID as parameter and then pick the instance with that UID in the function.
B
22
S
7
G
4
Posts: 154
Reputation: 3,709

Post » Sun May 15, 2016 9:44 am

http://www60.zippyshare.com/v/NhmVaemp/file.html

Download this capx. file I made. I read your code but it was just too much code. Apply my method to your game it will be easier any question on my code just ask.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Sun May 15, 2016 2:21 pm

@PixelPower Thanks for the .capx but I don't know if this works for what I need, I'm trying to reduce my event sheet with families.

@5Type Yes, the functions are the problem. I don't understand how to do what you said ... but I need to call this function with the family so I don't have to create functions for each enemy from the family.
B
36
S
10
G
9
Posts: 212
Reputation: 6,945

Post » Sun May 15, 2016 6:43 pm

@anty21ro

On the function call "Call Enemy_Air_Parts_Spawn" add an parameter and give it the value: Enemys_Air_test.UID
This becomes your Parameter 0 to the function.

So in your function On "Enemy_Air_Parts_Spawn" add the condition to pick that instance:
Choose your Enemy_Air_Test Family/Object and "Pick by Unique ID" (in the 'misc' section).

Your Unique ID is going to be the parameter you passed. You can access it by putting the value Function.Param(0).
B
22
S
7
G
4
Posts: 154
Reputation: 3,709

Post » Sun May 15, 2016 7:13 pm

@5Type
I've just finished an exemple .capx and I saw that you posted here, I was thinking to share it here and ask you to help me , I will try what you said but I will drop the .capx anyway since I've created it. Thanks

https://www.dropbox.com/s/333t9d7ci94ro ... .capx?dl=0
B
36
S
10
G
9
Posts: 212
Reputation: 6,945

Post » Sun May 15, 2016 7:25 pm

anty21ro wrote:@5Type
I've just finished an exemple .capx and I saw that you posted here, I was thinking to share it here and ask you to help me , I will try what you said but I will drop the .capx anyway since I've created it. Thanks

https://www.dropbox.com/s/333t9d7ci94ro ... .capx?dl=0



Here is a Link with implementation of what i told you:
https://www.dropbox.com/s/7txijtvmezsr0 ... .capx?dl=0
B
22
S
7
G
4
Posts: 154
Reputation: 3,709

Post » Sun May 15, 2016 7:42 pm

Thank you so much ! :)
B
36
S
10
G
9
Posts: 212
Reputation: 6,945


Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu, Yahoo [Bot] and 4 guests