Ever wanted to check to see if there is a collision within an arc of a circle or create a "cone of vision" for AI? Well, you can, and easily, with this asset! You do not even need to change anything, just add the scripts and call them like any other GML function!
This asset contains two sets of scripts:
- Set One: This set contains the basic collision_arc script that functions exactly the same as the GML collision_ functions, as well as an additional collision_arc_draw script that permits you to draw the defined collision arc to the screen in multiple different ways.
- Set Two: This set contains the advanced collision_arc_instance scripts. These scripts are designed to help create an AI "cone of vision", and as such require you to call a set up script in the Create Event of the instance to use them, before calling the general collision_arc_instance script in the Step Event. The idea here is that the scripts will not only check for an instance within the collision arc, but they will also check to see if the instance can be "seen" or not by checking to see if there is a line of sight between the calling instance and the "seen" instance. This line of sight will be checked against the "wall" object of your choice, or even a tile layer that you give (or both, so you can use the tile layer for "walls" and then use instances for additional obstacles). These instance scripts also have draw scripts, getter scripts and setter scripts, making them incredibly easy to use.