Exemplo n.º 1
0
        void CheckFood()
        {
            if (w.CheckCollision(b.body))
            {
                gameOver = true;
                Console.Clear();
                Console.SetCursorPosition(10, 20);
                Console.WriteLine("Game over!");
            }
            else if (w.CheckCollision(f.body))
            {
                w.Eat(f.body[0]);
                score++;
                f.Generate();
            }
            else if (w.CheckCollisionwithItself())
            {
                gameOver = true;
                Console.Clear();
                Console.SetCursorPosition(10, 20);
                Console.WriteLine("Game over!");
            }

            if (score > MaxScore)
            {
                b.Clear();
                b.body.Clear();
                level = 3;
                b.LoadLevel(3);
            }
        }
Exemplo n.º 2
0
 void CheckFood()
 {
     if (w.CheckCollision(f.body[0]))
     {
         eating = true;
         w.Eat(f.body[0]);
         Bally.Score += 10;
         f.Generate();
         foreach (Point p in b.body)
         {
             if (f.body[0].X == p.X && f.body[0].Y == p.Y)
             {
                 f.Generate();
                 f.Draw();
             }
         }
         foreach (Point p in w.body)
         {
             if (p.X == f.body[0].X && p.Y == f.body[0].Y && !eating)
             {
                 f.Generate();
                 f.Draw();
             }
         }
         eating = false;
     }
 }
Exemplo n.º 3
0
 void CheckFood()
 {
     if (w.CheckCollision(f.body[0]))
     {
         w.Eat(f.body[0]);
         f.Generate();
         f.Draw();
         w.Draw();
     }
 }
Exemplo n.º 4
0
 public void CheckFood()
 {
     if (w.CheckCollision(f.body[0]))
     {
         w.Eat(f.body[0]);
         Generate();
         score++;
         Score(score);
     }
 }
Exemplo n.º 5
0
 void CheckFood()
 {
     if (w.CheckCollision(f.body[0]))
     {
         point += 100 + level * 10;
         w.Eat(f.body[0]);
         if (point >= levels[level])
         {
             level++;
             speed -= 50;
             b.LoadLevel(level);
             Console.BackgroundColor = ConsoleColor.Gray;
             b.Draw();
             Console.BackgroundColor = ConsoleColor.Black;
         }
         f.Generate(new object[] { w, b });
         Console.ForegroundColor = ConsoleColor.Red;
         f.Draw();
         Console.ForegroundColor = ConsoleColor.Green;
     }
 }
Exemplo n.º 6
0
 void CheckFood()
 {
     if (w.CheckCollision(f.body[0]))
     {
         score++;
         if (score == 2)
         {
             degree++;
         }
         if (score == 5)
         {
             degree++;
         }
         w.Eat(f.body[0]);
         f.Generate();
     }
 }