Line of Sight for AI

So I am making a WW1 type game with trenches, and i have a working gun system and the enemies move randomly. This all works, however I can’t seem to figure out how to make it when you pop up from the trench that they start shooting at you. Someone help please?

Hi @TheLaidBackLama,

You’ll need to use the RayCast API in scripting - search this forum for examples, and let me know if you need help.

Cheers,
Geoff @ TechLeap

I took a look at raycasting, but I have one small issue. I have never used scripting before and am only familiar with coblocks. So it looks a bit like gibberish to me :sweat_smile:. Could you help me with understanding how it works or send me a tutorial? Much appreciated.

1 Like

Yes, I admit, when I first encountered Javascript around '98, I pushed it aside and learnt Perl instead.

There are plenty of Javascript tutorials around on the web, but the most useful thing (for working with JS in CoSpaces) is understanding the “dot notation” for objects.

Best of luck!
Geoff

1 Like