//Collsion public bool Collsion(Witch MC, Saint MC2, UserControl uc, Ball ball1) { Rectangle rec1 = new Rectangle(MC2.X, MC2.Y, MC2.size, MC2.size); Rectangle rec2 = new Rectangle(ball1.X, ball1.Y, ball1.size, ball1.size); if (rec1.IntersectsWith(rec2) && invicblity == false) { return(true); } else { return(false); } }
public bool Collsion(Witch MC, Saint MC2, int height, int width) { Rectangle rec1 = new Rectangle(MC.X, MC.Y, MC.size, MC.size); Rectangle rec2 = new Rectangle(MC2.X, MC2.Y, MC2.size, MC2.size); //Witch Collsion if (MC.Y <= 0) { MC.Y += 4; } if (MC.Y >= height - MC.size) { MC.Y -= 4; } if (MC.X >= width - MC.size) { MC.X -= 4; } if (MC.X < 0) { MC.X += 4; } //Saint Collsion if (MC2.Y <= 0) { MC2.Y += 4; } if (MC2.Y >= height - MC2.size) { MC2.Y -= 4; } if (MC2.X >= width - MC2.size) { MC2.X -= 4; } if (MC2.X < 0) { MC2.X += 4; } if (rec2.IntersectsWith(rec1) && invicblity == false) { return(true); } else { return(false); } }