public void getBloodBox(Graphics g, Player player, BloodBox box) { Rectangle plaRec = new Rectangle(player.PLANEX, player.PLANEY, player.Myplane.Width, player.Myplane.Height); Rectangle boxRec = new Rectangle(box.BoxX, box.BoxY, box.Box.Width, box.Box.Height); if (boxRec.IntersectsWith(plaRec) && player.ChangeBlood(0) && box.Exist) { player.ChangeBlood(20); box.getBox(); box.Exist = false; } else { box.Draw(g); } }