LOS question

0 favourites
  • 4 posts
  • How can I make multiple objects of the same type detect each others using Line Of Sight behavior? I really have troubles with undestanding how does picking system of the C2 engine works.

    Thanks in advance! :-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you mean 'multiple instances of the same object'

    there are a few ways you can get around this..

    one way is to store whatever you need off instance1 into a local variable, and then after that, with instance2, you can refer to the variables instead of trying to pick instance1 at the same time.

    for example, in your LOS case, you can do this:

    pick the target instance, and store its X and Y into local variables

    and then in the next event (not a sub event) pick the other instance, and check if it has LOS on the positions of those X and Y vars instead of with the actual target instance.

    This doesn't work all the time and so sometimes you need to juggle both instances at the same time.. you can use a family unconventionally: call it objectB, and inside that family is just the object.

    then in the events you can filter with Object and ObjectB separately, and refer to them both within the same condition and actions. even though they technically just refer to the same thing.. the family is a means of having a separate filtering of the same object.

  • Ok. Here is my example that does not work:

    Conditions are marked with "-"

    Actions are marked with "**"

    "Enemies" family has "ID" variable,

    "Enemy" object type is in that family.

    -Enemy has LOS to Enemies(family);

    -Enemy.ID not equal to Enemies.ID

    **Enemy.Stop

  • I've posted a .capx in this other thread that you might find useful

    http://www.scirra.com/forum/doctor-who-can-help-me-see_topic83819.html

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