How do I pick UID using families

Get help using Construct 2

Post » Tue Mar 18, 2014 2:36 am

I've created different families to different group of enemies. Now I'm trying to make all those simple colision events like this:
Image
But using families instead of identifying them directly. Basically, I'm trying to make a general event that, using families, identify the enemy of that family that colided with the character. Doing this way I don't need to repeat this condition for ALL enemies in the game. However, every enemy has it's instance variable that represent their damage. So, the difficult part, which is giving me headaches, is to pick the damage(variable) of an specific enemy that have colided with the character.

Ex:
Image

I've tried creating an Instance family variable to take the value(damage) temporarily and then subtract it from player's life. After that I'd set the variable Damage to 0 again.

Someone knows how to do it?
B
59
S
21
G
3
Posts: 604
Reputation: 6,691

Post » Tue Mar 18, 2014 2:41 am

You should have the instance value on the family, then the problem goes away. The same rule applies as the collision detection: put the variable on the family, so you don't have to duplicate it everywhere.
ImageImageImage
B
71
S
22
G
288
Posts: 3,858
Reputation: 158,422

Post » Tue Mar 18, 2014 2:51 am

blackhornet wrote:You should have the instance value on the family, then the problem goes away. The same rule applies as the collision detection: put the variable on the family, so you don't have to duplicate it everywhere.


I've already have an instance variable for the family and I can't do like this because every enemy has it's damage. They have different damage, I just can't put everything together in a family variable . Understand?
B
59
S
21
G
3
Posts: 604
Reputation: 6,691

Post » Tue Mar 18, 2014 3:18 am

The value will apply to each object, not the family as a whole!
ImageImageImage
B
71
S
22
G
288
Posts: 3,858
Reputation: 158,422

Post » Tue Mar 18, 2014 5:02 am

You are right!

I got it and it worked. Thank you!
B
59
S
21
G
3
Posts: 604
Reputation: 6,691


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests