Skip to main content
1 of 2
Zaky German
  • 1.1k
  • 2
  • 12
  • 16

top down game - checking, drawing enemy's line of sight area with obstacles

Examples of what i'm going to need: enter image description here enter image description here

I'm using cocos2d to draw a CCTMXTiledMap, on those tiles i'll have to draw the LOS triangle.

How would i test if the player is within that triangle, taking obstacles into account? How would i draw the line of sight area on the map tiles, again taking obstacles into account, like in the examples above?

This is a re-post of a question i've put on stackoverflow.

Zaky German
  • 1.1k
  • 2
  • 12
  • 16