LINE OF SIGHT - ENEMIES

Hi everyone,

I am a 2d animator an I am in need of some help in order to create my own game.
For GDevelop 5 I believe there are really few tutorials and so I was wondering if someone has figured out how to do a line of sight. Something that alerts the enemies of when the player is in their field of vision. There is this option in Construct 2 in the behaviours of a sprite.
I thought of using a solid like this and to attach it to each enemy but I’m not being able to figure out how to do it:

If you want to check a little more of how the gameplay is here is a clip:
https://youtu.be/V35W89A7NH8

(a lot of frames dropped while screen recording)

If you can help me I would be really thankful! :slight_smile:

https://imgur.com/vL4eXk5

Have you checked editor.gdevelop-app.com/?projec … athfinding
Search also for “basic artificial intelligence” example :slight_smile:

This is really interesting!! Was trying to find out how the raycast works! I think that if I study a little bit this code I could make it work on my game! Maybe trying to raycast only on X axis if possible. That could work for me. Thanks for the help!!

Was looking at the example from the link and I am wondering what are those yellow comment blocks in the actions, and how do I find them to use them in my projects? Never mind, I found it. :smiley:

Was looking at the example from the link and I am wondering also about how to determine when my player is in line of sight of a beserk robot so it can shoot at him. if he is above, below to the left of or the right of it.