• 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!

Shaders Only draw part of sprite that isn't blocked by a wall?

Divinik

Member
i misunderstood your post... more likely raycasting would be what you are looking for.. but is definitely out of my scope. sorry that im not of help on this one ;/

heres a semi relevant thread that might be of use..
https://forum.yoyogames.com/index.php?threads/enemy-line-of-sight.12888/

https://www.redblobgames.com/articles/visibility/

edit:

found another one on google searching for line of sight..

http://www.davetech.co.uk/fovtechdemo
Thanks man, I'll look into these!
 

Yal

šŸ§ *penguin noises*
GMC Elder
Here's an idea:
  • Get the angles of the FOV cone
  • Loop over the angles with some good step size
  • For each angle: loop from 0 to the max length of the vision cone. Check for wall collisions using lengthdir_x/y to get the point this far away from the start of the cone along the current angle, and if you find any, abort.
  • Draw individual triangles based on these lengths; they together constitute the full vision cone.
 
Top