Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class RectExtensions
- {
- // Both rectangles and the player positions
- public static bool Intersects(this Rect r1, Rect r2, Vector2 p1, Vector2 p2, out Rect area)
- {
- r1 = new Rect(r1.x + p1.x, r1.y + p1.y, r1.width, r1.height);
- // r2 is facing left
- r2 = new Rect(r2.x - p2.x, r2.y + p2.y, r2.width, r2.height);
- return r1.Overlaps(r2, true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement