A doubt with families

Just started using Construct 2? Post your questions here

Post » Wed Jan 20, 2016 2:24 am

Hi everyone!
Thanks for the patience! and sorry for my english U.u

Imagine a RPG gamelike, there are Archers ( A1,A2,A3), Knights (K1,K2,K3)

A1,A2,A3 have, each one, a variable instance "Damage", "Life" with diferent values..
K1,K2,K3 have variable instance "Damage", "Life" too with diferent values..

With families can i make that A1 makes his damage to K3, or A2 to K1, with manyfew expresions?

i think, making A1 when overlapping at offset X 10 to knight2, knight2 substract from "Life" Archer1.Damage
and this for all archers and knight respectively, is the wrong method to do this. i think with families would be better. I have been read the manual but still understanding. The instance variable for familie affect to all objects that are in? hmm Sorry, maybe this is very easy but i don't see the light yet hhehe

Edit: also add there are multiple instances of each object
B
4
Posts: 8
Reputation: 218

Post » Wed Jan 20, 2016 2:56 am

Families will make life easier. Changing instance variables affect the individual object, not everything in the Family.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Wed Jan 20, 2016 5:02 am

I agree with @blackhornet, families make your codewriting for several objects with the same attributes much simpler, cleaner
B
36
S
14
G
4
Posts: 172
Reputation: 4,110

Post » Wed Jan 20, 2016 5:53 am

Understanding families is definitely a must. However, you will need to get a good grasp on "picking" instances as well. This is covered well in "How events work" in manual: https://www.scirra.com/manual/75/how-events-work
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Wed Jan 20, 2016 10:37 am

Aaah, yeah, i understand now, Thanks!
B
4
Posts: 8
Reputation: 218


Return to Beginner's Questions

Who is online

Users browsing this forum: kainrazial and 3 guests