How do I properly understand Line of Sight?

  • The game I am making is a top down dungeon crawler, and I have an enemy that has four directions.

    It has pathfinding and Line of Sight on it

    However, I'm really struggling to understand the cone of view and what direction the enemy is looking when the capx is ran.

    I know I'm being an idiot!

  • The direction the enemy is looking is the angle of the enemy object, so if 0 its looking right, if 180 its looking left, although its obvious if you are using 8 direction and its moving in a certain direction, whichever way it is facing is the front of the enemy.

    have you ever played Metal Gear Solid? the cone of view is just a line of vision that starts where the player is facing and expands round in a cone shape. The default cone of view is 360 which is basically a circle around the enemy. If you set it to 45 its like a 45 degree segment of view in front of the enemy, check out this image example from MGS where guards use a cone of vision : upload.wikimedia.org/wikipedia/commons/thumb/f/fd/MGS_Solton_Radar_Shot.svg/266px-MGS_Solton_Radar_Shot.svg.png

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for responding plinkie,

    I get that the 'usual' cone of view is 45 degrees. However, If I set the enemies angle to zero to begin with and give him a 45 degree cone of vision with a LoS of 300 and stand right in front of him, he doesn't count as having LoS to the player. Weird.

  • As an update to this,

    I now have the enemy following the character, we have a snag with animations ...

    As this is a top-down zelda-esque game, we have four directional animations. I'd like the enemy to switch to the direction animation most appropriate for the direction he is moving in. However there seems to be no condition to find the direction of movement during a path find.

  • Object.Pathfinding.MovingAngle is the direction of movement

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