0 Favourites

enemies - how to do it correctly?

  • 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?

  • 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.

    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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

    Thanks for the info, what would you suggest when i want to multiply my enemies, what should i do first?

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)