Single vs multiple monster objects

0 favourites
  • 3 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • What is the correct way to go;

    a) Create a single monster object and change it's sprite, health + other attributes when it's created

    or

    b) Have own object for each monster type?

    Since I have to do collision checks, destroy checks, scoring checks etc. to monsters, wouldn't b) method make me have to do this multiple times? Or can I group a set of objects and have events for the group?

    Imagine me creating a game where there's 100+ different monsters and each have different speed, different bullets, different health, different sprite, different name, different loot drops. What would be the best way to approach this?

  • Hey unska, <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Construct 2 has a feature called "Families" which might help out in this case.

    Manual > Families: https://www.scirra.com/manual/142/families

    You can put several objects in a family, then write events that apply to the family , and those events will affect all the family member objects.

    You can also add private variables to a family, and all family member objects will get their own local copies of those variables. This could be handy for the properties common to all monsters, speed, bullets, health, sprite, name, loot drop, and such.

    As for collisions and graphics, for a single character I usually create two separate dedicated objects. One for collisions, physics, and motion, and one for the graphical representation of the object in the game. The physics object will be invisible. The graphics object will be pinned to the physics object. This way my collision geometry can be very simple and predictable, and my graphics can be modified without affecting the collision properties of the character.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Whoah, incredible. Thanks!

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