create a object out of a group of other objects?

Get help using Construct 2

Post » Tue Jul 23, 2013 11:23 pm

If you have something like a single bingo card(ticket), it consists of 25 hand placed text or sprites representing the numbers, plus back ground images, daubed state etc.

If you have a variable number of cards, it makes sense to create one card,then clone it at runtime (depending on how many they purchased) and put them in different locations.

I.e. you are making a new object (the bingo card) out of lots of smaller objects.

Is there a way to do this?

I tried using families, but this fails because:
1) you can only put the same type of object in a family. e.g. only sprites
2) you cant seem to clone a family and change its position (at least i could not work out how.

I saw you can put objects into a container, but:
a) I dont know what the container object should be (there dont seem to be any container type objects)
b) Once you have a container object, I dont know if you can clone it to create complete copies, and access their sub objects.

Even nicer would be if you could associate events/behaviour with this composite object, like you would in an object oriented language. E.g. so you could say something like "foreach (bingocard) {bingocard.generateRandomNumbers()}.
nutmix2013-07-23 23:25:17
Posts: 370
Reputation: 3,942

Post » Tue Jul 23, 2013 11:50 pm

To use a container, click an object to view it's properties. You will see Container below Effects.

Now click Create.

A window will pop up asking you to add other objects to the Container. You can add/remove objects at any time.

When ever you create any object in a Container, Construct will create all the other objects in the Container automatically.

When any object in a Container is "picked", all other objects in the Container are also picked.
Posts: 59
Reputation: 3,779

Return to How do I....?

Who is online

Users browsing this forum: lennaert, mikva, ThePakernator and 11 guests