Single vs multiple monster objects

Get help using Construct 2

Post » Thu Apr 02, 2015 8:18 am

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?
B
4
Posts: 10
Reputation: 220

Post » Fri Apr 03, 2015 10:15 am

Hey @unska, :)

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.
B
21
S
13
G
8
Posts: 306
Reputation: 5,458

Post » Fri Apr 03, 2015 10:12 pm

Whoah, incredible. Thanks!
B
4
Posts: 10
Reputation: 220


Return to How do I....?

Who is online

Users browsing this forum: duke2704, Yahoo [Bot], Zebbi and 14 guests