Problem with Line of Sight Behavior and Custom Obstacles

Discussion and feedback on Construct 2

Post » Wed Jun 25, 2014 10:43 pm

Firstly pardon me if I'm posting this in the wrong place, I'm still a little new to this forum.

So I have been using the line of site behavior in my game on enemies to tell if they can "see" the player. For obvious reasons, they shouldn't be able to see through doors, walls, ground. But i added other obstacles, giving the player opportunity to "hide" from the enemy using various objects in their environment. So I set obstacles to Custom because allowing me to dynamically set which objects are obstacles (player can use to hide) and which aren't depending on varying conditions, instead of just setting the line of sight obstacles to Solid.
Here's my issue; A "closed door" should be an obstacle to line of sight and an "open door" shouldn't (i.e., enemy should be able to see player if the player is behind an open door). So what I did was that it set up my event sheet in such a way that at the beginning of every loop, each enemy's line of sight obstacles are cleared, then for each enemy and for each door, if the door is closed (if the door's instance variable of boolean type, aptly named open, is false, ie door closed) then add that door to the obstacles of that enemy's line of sight. But that doesn't seem to work. it seems that when I add the action Add Obstacle Door to Enemy Line of Sight, it adds all the doors, not a the specific closed door. What am I doing wrong? Does Construct's Line of Sight behavior have the ability to distinguish which instance of an object is an obstacle or do they all have to be obstacles?
B
5
S
1
Posts: 24
Reputation: 443

Post » Wed Jun 25, 2014 10:56 pm

As far as I know it only distinguishes object types. You might need an 'open door' object type that doesn't get added to Obstacles. If you had the paid version you might add 'obstacle' types to a family. Feel free to post a .capx or screenshot.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Jun 26, 2014 7:56 am

I thought as much. Creating a separate object for open doors might be my best, albeit cumbersome, option. So when I door is opened it would spawn a closed door closed door object and destroy the open door object.
I'll post a screenshot or .capx soon enough.
B
5
S
1
Posts: 24
Reputation: 443


Return to Construct 2 General

Who is online

Users browsing this forum: Brendan2007 and 6 guests