Compare the variable of an item within a family?

Get help using Construct 2

Post » Sun May 05, 2013 4:46 am

Hey everyone,
I have a question. Is possible compare the variable of an item within a family?

Eg
When the player colliding with an item (a sword, for example) go through the inside of a family and locate it inside the family.

Thanks
B
21
S
4
G
2
Posts: 96
Reputation: 2,392

Post » Sun May 05, 2013 5:20 am

Add a instance variable to the family called 'id'. Set the id of the sword to 1 (and I assume you have other weapons? So for each of them you give another id) you can do this by just selecting the sword, you don't need events.
Then on the events do this:
Condition: Player collides with FamilyWeapons
>Sub-Event: FamilyWeapons.id = 1
>>Result: Do actions, because you picked the sword, eg: destroy FamilyWeapons (this will destroy only the sword, because the sub-event picked only the object with id = 1)
>Sub-Event: FamilyWeapons.id = 2
>>Result: Do actions, because you picked the bow
etc...
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sun May 05, 2013 5:45 am

Really works. Thank you @7Soul =)
B
21
S
4
G
2
Posts: 96
Reputation: 2,392


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], HugeCube, imnotspecial, tomi71, totoe and 21 guests