Beispiel #1
0
 private void EatSkull()
 {
     if (snake[0].Location.X == rP && snake[0].Location.Y == rQ)
     {
         for (int _i = 1; _i <= score; _i++)
         {
             this.Controls.Remove(snake[_i]);
         }
         score           = 0;
         labelScore.Text = "Score: " + score;
         timer.Stop();
         AddBird_2.Stop();
         DeleteBird_2.Stop();
         AddBird_3.Stop();
         DeleteBird_3.Stop();
         AddSkull.Stop();
         label1.Visible = true;
         label2.Visible = true;
         Yess.Visible   = true;
         No.Visible     = true;
         this.Controls.Remove(skull);
         rP = 700;
         rQ = 600;
     }
 }
Beispiel #2
0
        private void Update(Object myObject, EventArgs eventArgs)
        {
            MoveSnake();
            EatBird();
            Border();
            EatBird_2();
            EatBird_3();
            int i = score;

            EatSkull();
            if (i >= 150)
            {
                label3.Visible = true;
                label4.Visible = true;
                Yess.Visible   = true;
                No.Visible     = true;
                timer.Stop();
                AddBird_2.Stop();
                DeleteBird_2.Stop();
                AddBird_3.Stop();
                DeleteBird_3.Stop();
                AddSkull.Stop();
                label2.Visible = true;
            }
        }
Beispiel #3
0
 private void EatBird()
 {
     if (snake[0].Location.X == rI && snake[0].Location.Y == rJ)
     {
         labelScore.Text = "Score: " + ++score;
         PictureBox pictureBox = new PictureBox();
         snake[score]           = pictureBox;
         snake[score].Location  = new Point(snake[score - 1].Location.X + 20 * dirtX, snake[score - 1].Location.Y - 20 * dirtY);
         snake[score].Size      = new Size(sizeOfSides, sizeOfSides);
         snake[score].BackColor = Color.Gold;
         this.Controls.Add(snake[score]);
         GenerateBird();
         AddSkull.Start();
         DeleteSkull.Start();
         AddBird_2.Start();
         DeleteBird_2.Start();
         AddBird_3.Start();
         DeleteBird_3.Start();
     }
 }