How to "upgrade" an object to a family

Favourite 53 favourites
Tutorial written by AshleyOriginally published on 23rd, April 2013 - 2 revisions

It's always good to plan ahead when making a project, and determine when you'll need a family in advance. However it's easy to forget and end up with a large number of events using a specific object type, when you'd rather all those events were for a family instead. This tutorial will show you how you can convert all those events to refer to a family, preserving any references to instance variables or behaviors, without having to re-do all the events by hand.

An example

Suppose we have an object Monster which we want to replace with a family called Enemies so we can easily add different kinds of enemies... but we already have 100 events for Monster! Here's how to "upgrade" it to a family.


This tutorial involves changing large parts of your project. If you make a mistake, you could end up with quite a mess. So be sure to make a backup of your project first. If you haven't already, you should also turn on Construct 2's automatic backup.

The process

First of all, we need to create the family to replace with. We can't create an empty family, so in fact first we need to create an empty object which will only be used temporarily. In this case, create a new Sprite and add it to the layout (no need to worry about its image, we'll delete it later). If you're replacing a different kind of object, like a Text object or Tiled Background, create one of them instead.

Next, create the family. In this case we'll call it Enemies. When prompted to add an object to the family (since it can't be empty), add the empty object you just created and press OK.

Now we need to add all the same instance variables, behaviors and effects that the object has to the family. Objects can only be replaced with other objects or families with matching instance variables, behaviors and effects, so we need to add matching ones to the family. They must all have identical names. For example, if Monster has the number instance variables health and speed, and a bullet behavior named Bullet, we must add health and speed number instance variables to the Enemies family, as well as a Bullet behavior.

Now the events can be replaced with a reference to the family! In your event sheet, select all (Ctrl+A) then press R (for Replace Object). First choose the object you want to replace (in this case the Monster), then you can choose to replace it with the new family. If the family does not appear, or a message appears saying there are no objects that it can be replaced with, double-check the family has exactly the same instance variables, behaviors and effects, all with the same names and types. If you have multiple event sheets with events referring to the object, you'll also need to repeat this process for each event sheet, selecting all the events then replacing the object with the family.

Your events now refer to the family! But the original object - our Monster - is not in the family. We can't add it yet either, since its own instance variables and behaviors conflict with the family's.

So now delete all the instance variables, behaviors and effects from the original object. Try not to feel too nervous - by now there should be no events referring to the object at all, since we replaced them all with the family. (And you made a backup earlier... right?)

In the project bar, edit the new family and add the object to the family. In this case we'd add the Monster object to the Enemies family. If you get an error, make sure you deleted all the instance variables, behaviors and effects from the object. We also don't need the temporary object any more, so you can remove the temporary object from the family, then delete it from the project completely from the project bar.

End result

Now all your events refer to the family instead of the object, and the object inherits all the same instance variables, behaviors and effects from the family. So it works exactly how it used to, but you can now add other objects to the family, taking advantage of applying the family events to different object types. Hopefully this will come in handy at some point!

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.


JackAttackNZ 2,416 rep

Thank you taking the time to write these tutorials!

Tuesday, April 23, 2013 at 10:15:36 PM
RandomExile 12.2k rep

Oh my gosh, you're going to save me a monster headache!! Thanks a billion, favorited.

Tuesday, April 23, 2013 at 10:25:30 PM
naragames 2,948 rep


Tuesday, April 23, 2013 at 11:01:05 PM
donelwero 3,335 rep

Thanks, this is great!

Tuesday, April 23, 2013 at 11:48:20 PM
JoyfulDreamer 8,316 rep

Just be careful, I found out that object references in functon call arguments are not updated. ;) Also, since C2 can already update object names when renaming, I can't see why there can't easily be a "rename to family name" option. :)

Wednesday, April 24, 2013 at 3:03:38 AM
Lordshiva1948 44.3k rep

Yes this is nice tutorial. You made game making even easy. Thanks again

Wednesday, April 24, 2013 at 9:09:57 AM
thehen 12.0k rep

Just did this and it worked a treat. Thanks!

Thursday, April 25, 2013 at 9:27:58 PM
Lordshiva1948 44.3k rep

Thanks mate for taking time to explain it in this tutorial.

Sunday, April 28, 2013 at 3:20:38 PM
EddyDingDongs 3,447 rep

Thank you so much, helps me heaps since i pin many objects to each character in my game.. Awesome!

Saturday, November 16, 2013 at 8:31:16 AM
Tarkion 2,884 rep

Thanks for this tutorial!! :)

Tuesday, February 11, 2014 at 1:31:41 PM
Tarkion 2,884 rep

hmm whats happen if example enemies have variable instance so: monster1_life, monster2_life, monster3_life, etc... I supose can´t do the family then... isn´t it?

Wednesday, February 12, 2014 at 10:14:18 AM
randyhook 526 rep

Thanks for writing this article. I'm new to Construct 2 and this was an issue I was already struggling with. It's much appreciated.

Wednesday, March 26, 2014 at 1:09:35 AM
metafaniel 435 rep

Thanks for the help, BUT what about if I have the System action "create object"?? Is there a way I can refer to an exact member of the family? Thanks!

Monday, May 05, 2014 at 11:20:00 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.