Is there a way to implement line of sight for enemies?

billpaternobillpaterno Member Posts: 26
edited November -1 in Working with GS (Mac)
How would I go about giving actors (enemies) a line of site so that they would approach my main actor only if they see him? It is kind of a complex idea I suppose as you also have to take into account if the main actor is behind an object making him "hidden". Just curious if this is at all possible as I would like to implement something along the lines in my game.

Thanks in advance,
billpa

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    a terrible idea, but it might work, would be to send out invisible "bullets" from the enemy to the player. if the bullet only collides with the player, then the enemy can see him.

    but that is a pretty terrible way to go about it. just a quick thought.
  • TboneTbone Member Posts: 49
    I've done something like this. I used an invisibile actor whose position is offset depending on which direction my actor (enemy) is facing. So when my hero collides with the invisible actor it activates my enemy to action... Shoot, pursue, whatever.

    Kind of like line of sight.
  • quantumsheepquantumsheep Member Posts: 8,188
    Yep - the Metal Gear Solid way ;)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • billpaternobillpaterno Member Posts: 26
    both interesting ideas...I will definitely check them out.
Sign In or Register to comment.