Example #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);
            }
        }