Enemy raycast?

So I’m trying to give my enemy “eye sight”. How would I use a raycast line on the X AND the Y scale so I can cast a line of sight as far as needed so the enemy can see the player and obstacles?

Any help as always is GREATLY appreciated! <3

Thank You so kindly! <3

Someone can help?

Looks like there are a good chunk of examples about how to check if a Phaser.Geom.Line intersects with other shapes: https://labs.phaser.io/index.html?dir=geom/intersects.

If you give your enemy a line as its “eyesight”, you’ll be able to check if that line is intersecting with the player and other obstacles using those intersection methods in the examples.

How do you actually view the code on the examples at this address?

Click Edit.