• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Enemy detects when a player enters the field of view

N

neryt

Guest
Hi, I'm trying to do to the enemy detects when a player enters the field of view in which is aimed. Below a picture of the explanation exactly what I mean.

Thank you for your help
 

NightFrost

Member
It seems to me the other topic is pretty much what you want. To measure distance between the enemy and the player, use point_distance. If the distance is actionable, check player direction using point_direction and compare it to enemy facing with angle_difference. If the result is within enemy's field of vision angle, the player has been detected.
 
L

LazyEpic

Guest
nope this is not what i mean :D
but thanks for this any way
If not that then what exactly do you mean because as NightFrost says the thread above is exactly about that? But if you are uncomfortable with maths you could use a sprite of a cone linked to your enemy and use collisions, however this is very simplistic, problematic and wont really be scalable or efficient.
 
A

anomalous

Guest
You can also throw a collision_line in there from the foe to the player, to ensure you have unobstructed LOS.
 
Top