Esempio n. 1
0
 private bool IsCollision(Raindrop raindrop)
 {
     if (raindrop.pic.Location.X > button1.Location.X && raindrop.pic.Location.X + 30 < button1.Location.X + button1.Width && raindrop.pic.Location.Y + 30 == button1.Location.Y)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Random     random = new Random();
            PictureBox pic    = new PictureBox();

            solid.Color  = colors[random.Next(0, colors.Length)];
            pic.Location = new Point(random.Next(0, Width - 40), 0);
            pic.Size     = new Size(30, 30);
            pic.Paint   += new PaintEventHandler(pictureBox_Paint);
            Controls.Add(pic);
            Raindrop raindrop = new Raindrop(pic, solid.Color);

            raindrops.Add(raindrop);
        }