This hitscan system breaks when using R174 or higher, but works perfectly on R173. No idea what the real cause is, but it might be the collision detection.
Description of Capx
Contains simple top-down scene with player, enemies with no AI, and some walls.
1. Draw a line
2. Check if any objects are overlapping the line. If true, record the object type, the distance from the object and the origin of the line, and the objects UID.
a. If it's overlapping a wall, break the wall down into a vector for each side, then find out where on that vector does the line cross. (Line intersection algorithm not by me.)
b. If overlapping an enemy, stop.
3. Once all objects are recorded, sort the array on the X axis (This is why 'distance' is on top of the array)
4. For each element on X axis, do stuff based on what object was hit.
5. Clean everything up
Steps to Reproduce Bug
- Install 174+
- Run and notice the wacky detection for the lines
- Install 173
- Run and notice it works perfectly
The line ends at weird positions and outright ignores some walls, especially at strange angles.
Line stops at a wall based on the lowest distance
- Chrome: YES
- FireFox: YES
- Internet Explorer: ???
Operating System and Service Pack
Windows 7 64-bit Service Pack 2
Construct 2 Version ID
Construct 2 R173-R175