Line of Sight Weirdness

For questions about using Classic.

Post » Tue Jul 27, 2010 6:11 pm

So, i've been trying to use the Line of Sight behaviour and it doesn't seem to work the way i think it should be working.

Specifically, i have a grid based game and i want some cameras to detect a player only in the four cardinal directions, up, down, left, right. I thought that if i use code like "camera.x equals player.x" and pair it with LOS code like "if player is in line of sight of camera" then the camera should detect the player if the player is not behind a solid and only if the player is directly above, below or to the sides of the camera.

However, if i use code like this, it works fine if the player is to the right and below the camera, but not if the player is above or to the left of the camera. I've checked the "line of sight angle range" and made sure it was at 360 but it doesn't work.

Help?
B
2
G
3
Posts: 52
Reputation: 954

Post » Tue Jul 27, 2010 6:51 pm

Hi feeblethemighty is this what you are after?

http://dl.dropbox.com/u/1646976/Lineofsight.cap

Made using the latest unstable build.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Tue Jul 27, 2010 9:23 pm

I'm using the latest stable build (99.91 i believe) and your cap works perfectly. But the code that i had, which was pretty much the same except for the else at the bottom of the Camera event sheet, it still does not detect the player when he is to the left or above.

Would you mind taking a look at it? I can PM you the cap.
B
2
G
3
Posts: 52
Reputation: 954

Post » Tue Jul 27, 2010 9:31 pm

yeah sure send me the cap :)
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Wed Jul 28, 2010 3:48 pm

So, for anyone else having weird issues with the LOS behaviour, try making sure that the objects that have the LOS behaviour and the objects they are looking for are not Solid. That seemed to fix the problem i was having.
B
2
G
3
Posts: 52
Reputation: 954


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests