LOS question

Get help using Construct 2

Post » Wed Jan 08, 2014 1:03 pm

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! :-)
B
8
S
1
Posts: 9
Reputation: 595

Post » Wed Jan 08, 2014 4:08 pm

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.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Jan 09, 2014 6:05 am

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.StopRapidTom2014-01-09 06:06:37
B
8
S
1
Posts: 9
Reputation: 595

Post » Thu Jan 09, 2014 2:23 pm

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
B
28
S
8
G
1
Posts: 469
Reputation: 4,683


Return to How do I....?

Who is online

Users browsing this forum: yiuyiu6666 and 26 guests