public bool OutsideWorldFrame(PictureBox tar) { if (tar.Location.X < 0) //czy wychodzi z lewej lub prawej strony { return(true); } if (tar.Location.X > WorldFrame.Width) { return(true); } return(tar.Location.Y + tar.Height > WorldFrame.Height - 3 || WorldObjects1.Where(obj => obj != null).Any(obj => tar.Bounds.IntersectsWith(obj.Bounds))); }
public bool InAirNoCollision(PictureBox tar) { //sprawdza czy picturebox jest poza ramką return(!OutsideWorldFrame(tar) && WorldObjects1.Where(obj => !tar.Bounds.IntersectsWith(obj.Bounds)).Any(obj => tar.Location.Y < WorldFrame.Width)); }
public bool NoCollision(PictureBox tar) { return(WorldObjects1.Where(obj => obj != null).Any(obj => tar.Bounds.IntersectsWith(obj.Bounds))); }