How do I Reference Family Instances with Line of Sight

0 favourites
  • 7 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • I have 8 or so objects in the family "entity." Each of these objects has a "e_GPS" object which controls the facing animation of these objects in an isometric map. This e_GPS object also has the Line of Sight behavior because it is the only object for "entities" which actually changes it's angle.

    Here is the problem. I want to say: If "e_GPS" has line of sight of "e_GPS" store ID of instance 0 and store the ID of instance 1 (as you might do with collisions referencing instances within a family).

    The system is not referencing either of these objects with the "pick 'e_GPS' instance X".

    So how can I pick object/family instances in a Line of Sight event, and have it so that the line of sight operation works even when trigger 50+ times simultaneously.

  • I believe you can do something like:

    events

    Has line of sight to e_GPS

    for each e_GPS

    action

    Do something with the info from the e_GPS's in your line of sight.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried that. It would only reference its own e_GPS and would not retrigger the has_LoS condition

  • You need a second family with the same items (e_GPS2) so you can do "e_GPS has LOS of e_GPS2", for example.

  • As you loop through the objects with LOS, your own can be included, just keep that in mind and use actions accordingly.

    ie

    id = myid do nothing

    id <> myid so something

    But if your own object is solid, it could be interfering to what it can potentially see with LOS.

  • You may be right about it blocking its own LoS because of solid behaviors. I do not think it was solid, but possibly another behavior (Pathfinding, 8 Direction, etc) caused it to block LoS.

    As far as a second family goes. I could do this, but I have 10+ unit types and a ton of functions which reference that family universally. I would have to double my functions.

  • You don't need to use the duplicate family for anything but picking the LOS. You can grab the UID of both objects and reference the single family after that, if that's what you need.

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