Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rectangle a = Bounds, b = level.Bounds;//, inter = new Rectangle();
- a.Y += a.Height - feet_size;
- a.Height = feet_size;
- if (!(a.Intersects(b)))
- return false;
- /*inter.X = Math.Max(a.X, b.X);
- inter.Y = Math.Max(a.Y, b.Y);
- inter.Width = Math.Min(a.Width, b.Width);
- inter.Height = Math.Min(a.Height, b.Height);
- Rectangle a_src = source, b_src = level.source;
- b_src.Width = a_src.Width = inter.Width;
- b_src.Height = a_src.Height = inter.Height;
- if (a.Y > b.Y)
- b_src.Y += a.Y - b.Y;
- if (a.X > b.X)
- b_src.X += a.X - b.X;
- else
- a_src.X += b.X - a.X;
- a_src.Y += Height - feet_size;*/
- Rectangle a_src = new Rectangle(), b_src = new Rectangle();
- a_src.X = sprite * Width;
- a_src.Y = (bank * Height) + (Height - feet_size);
- b_src.X = Convert.ToInt32(Math.Max(level.position.X, position.X));
- b_src.Y = Convert.ToInt32(Math.Max(level.position.Y, position.Y));
- b_src.Y -= Convert.ToInt32(Math.Min(level.position.Y, position.Y));
- b_src.Width = a_src.Width = Math.Min(Width, level.Width);
- b_src.Width = Math.Min(b_src.Width - b_src.X, b_src.Width + b_src.X);
- b_src.Height = a_src.Height = feet_size;
- Color[] bitsA = new Color[a_src.Width * a_src.Height];
- Color[] bitsB = new Color[b_src.Width * b_src.Height];
- src.GetData(0, a_src, bitsA, 0, bitsA.Count());
- level.src.GetData(0, b_src, bitsB, 0, bitsB.Count());
- int ux = Math.Min(a_src.Width, b_src.Width),
- uy = Math.Min(a_src.Height, b_src.Height);
- for (int y = 0; y < uy; y++)
- {
- int a_point = y * a_src.Width,
- b_point = y * b_src.Width;
- for (int x = 0; x < ux; x++)
- {
- Color ca = bitsA[a_point + x];
- Color cb = bitsB[b_point + x];
- if (ca.A > 0 && cb.A > 0)
- return true;
- }
- }
- return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement