Hey, great plugin. Thanks for sharing.
I made an icon you can use if you like it. icon
the 16x16 looks nice, but the larger ones look like they have been upscaled from that smaller one, and don't look as nice.
Nice plugin. Here's a quick thought on the normal being wrong on flipped tiles. Normally the collision polygon have it's points ordered in the same way (cw or ccw). This is called winding. So when a ray hits an edge you can take the angle from one point of the segment to the other, and if the points have clockwise winding you can subtract 90 and get the normal.
Mirroring will switch the winding and so will mirroring. So if something is both flipped and mirrored the winding will be the same as they are originally. Negative sizes of sprites have the same affect as flipping and mirroring.
Roughly it would look like this, it might need to be swapped:
If mirrored xor flipped
That can fail though if the user creates a collision polygon with a reversed winding. It's not common but it has happened before. I didn't handle it and instead had the user correct his collision polygon, but you can handle it in code by either checking the winding of the polygon or sampling a point on one side of the edge to know which side is inside the polygon.
I am already aware of what causes it, and have been considering testing which side of the line the start point is on to fix it. But thanks anyway.
As far as speed goes, the best improvement would be to do some kind of spacial partitioning of the objects you cast to.
Isn't this what the collision cells do?
You can also calculate the reflection angle without vector math.
ReflectAngle = 2*normal-rayAngle
Thanks! I'm gonna use this now.