Line of Sight Weirdness

This forum is currently in read-only mode.
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • 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.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi feeblethemighty is this what you are after?

    Made using the latest unstable build.

  • 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.

  • yeah sure send me the cap

  • 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.

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