Connect several objects

Get help using Construct 2

Post » Sat May 11, 2013 3:47 pm

Hello,
Im evaluating construct 2 for my company development. One of the things we are trying to do is:

In one of our games there are several levels. Each level shows a map of connected objects . Example

Obj A -> connects (C1 name of the connection) to Obj B

If i click obj A the goal is to highlight C1 to Obj B.


Our question is: how can i after add obj A and B to the layer can automatically create a sprite called "line C1" that goes and connects both objects ?

Thanks
B
5
Posts: 17
Reputation: 359

Post » Sat May 11, 2013 4:13 pm

I don't fully understand the explanation of what you want, but I think I can guarantee that is is possible..

There are multiple ways of pairing or connecting objects.

The simplest way is via 'Containers', the manual page for them will explain it better than me.

but..
a more flexible way and possibly what you need is to manually store UIDs (unique ID) in private variables.


First, give ObjectA the private variable 'objectBuid' or just something like 'bUID' for short..

then, when you want to pair them, (for example on creation of the objects, or on a 'connection'), Object A can store the UID of Object B like this:
set objectA.bUID to objectB.UID

and so then you can pick the right objectB that is referred to in objectA.bUID

for example:

+on objectA clicked
+pick objectB by UID : ObjectA.bUID

hope that wasn't too confusing.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sat May 11, 2013 5:47 pm

B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Sun May 12, 2013 9:31 am

thanks
B
5
Posts: 17
Reputation: 359


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest