enemies - how to do it correctly?

Get help using Construct 2

Post » Sun Sep 01, 2013 7:49 pm

Greetings!

im at the point where i created a "functional" enemy with his animations + death animation as a separate object spawned on his death.

Now i want to add more enemies and looking for a process how to simplify all this. I heard of families but right now im not familiar with the basics. Is this the point where i need to create family for enemies?

B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Sun Sep 01, 2013 8:17 pm

Families are great for grouping objects to simplify code, however they do create some issues when trying to pick particular objects and referencing instance variables etc.

https://www.scirra.com/tutorials/556/understanding-picking-with-respect-to-families

But, used properly you can use them to optimize your code quite a bit. Basically they group objects so you can do things like hit check against all objects in the family "monsters" versus checking against Troll, then Archer, then Grue, etc etc.
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Sun Sep 01, 2013 10:13 pm

[QUOTE=Venivididormi] Families are great for grouping objects to simplify code, however they do create some issues when trying to pick particular objects and referencing instance variables etc.

https://www.scirra.com/tutorials/556/understanding-picking-with-respect-to-families

But, used properly you can use them to optimize your code quite a bit. Basically they group objects so you can do things like hit check against all objects in the family "monsters" versus checking against Troll, then Archer, then Grue, etc etc. [/QUOTE]

Thanks for the info, what would you suggest when i want to multiply my enemies, what should i do first?
B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Mon Sep 02, 2013 4:59 pm

Create a new family, and then add your current enemy to it. As you create new enemies just add them to the family list. When doing hit detection or picking of other kinds, use the family as the target, instead of the specific enemies seperately.

The link above will explain some of the more in depth stuff you'll need if you make your enemies more complex, and require instance variables for tracking monster type and health etc.Venivididormi2013-09-02 17:07:58
B
8
S
2
Posts: 63
Reputation: 1,223


Return to How do I....?

Who is online

Users browsing this forum: 25games, Ashley, leotardozc, TRMG and 23 guests