Connect several objects

  • Hello,

    I�m 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)