Composite Object Families in Editor

Get help using Construct 2

Post » Fri Jul 28, 2017 9:16 am

Hi all,

How can "link" objects together?

Let's say I have 5 different sprites in the editor (e.g. football, tennis ball, golf ball, ...) which share some behaviour and therefore are grouped in a family ("Balls").

I also have 5 different "Indicator" sprites in the editor (with different sizes to fit the respective ball). Now I want to move the indicators with the balls and show/hide them.

My problem is not the moving or showing/hiding part, but the fundamental logic how to link Indicator A to ball A, Indicator B to ball B and so on.

I hope you can point me out some tipps?

Any hints appreciated!

Thx a lot
B
4
Posts: 13
Reputation: 210

Post » Fri Jul 28, 2017 6:30 pm

B
33
S
18
G
27
Posts: 2,450
Reputation: 20,364

Post » Fri Aug 04, 2017 1:32 pm

Thank you veeery much for pointing out containers 99Instances2Go.

So I know how to create a container with e.g. "Football" which references "Football_Indicator". But how do I create a generic familiy which references another family?

For my example: Family "Balls" references Family "Indicators".

When I pick the object Football, I get the object Football_Indicator
When I pick the object Golfball, I get the object Golfball_Indicator.
When I pick the object Basketball, I get the object Basketball_Indicator.
... and so on for another 10000 types of balls ;)

How can I destroy/highlight or whatever (It's just about the picking) the respective indicator when I touch an object?

Thanks again for helping me out - to finally understand the fundamentals of construct ;)

For now I have done a really messy workaround. This can't be the solution... I just post it here to make the problem even more clear:
- I have created a family variable "REFERENCE" in family Balls, and a family variable "REFERENCE" in family Indicators.
- I have manually written e.g. "FOOTBALL" into the REFERENCE field of the Ball and the Indicator object
- Then, whenever a ball was clicked, I iterated over all Indicators and checked if the indicator REFERENCE matched the Ball REFERENCE.

PS: I have also done a small test setup project, but it seems I cant paste URLs here..
B
4
Posts: 13
Reputation: 210

Post » Fri Aug 04, 2017 6:56 pm

I do not know how to make Familys play nice, friendly and useful with Containers. I did't catch that it is about family's.

When family's are in play, i use an instance variables to pair objects.
https://www.dropbox.com/s/o8ige6sf7goz2 ... .capx?dl=0

But why not make it yourself a lot easier ? Talking extensively about 1000 "faces" now. Even assuming that they all have different properties like Jumpiness, that can be written in a .json (in a text editor, or a online json editor)
https://www.dropbox.com/s/03eaewwuuxe2w ... .capx?dl=0
B
33
S
18
G
27
Posts: 2,450
Reputation: 20,364


Return to How do I....?

Who is online

Users browsing this forum: FlyingRam, jkmalau, Manubis and 8 guests