Esempio n. 1
0
        public void Move()
        {
            while (true)
            {
                if (points[0].x + dx < 0)
                {
                    continue;
                }
                if (points[0].y + dy < 0)
                {
                    continue;
                }
                if (points[0].x + dx > 40)
                {
                    continue;
                }
                if (points[0].y + dy > 40)
                {
                    continue;
                }

                Clear();

                for (int i = points.Count - 1; i > 0; --i)
                {
                    points[i].x = points[i - 1].x;
                    points[i].y = points[i - 1].y;
                }

                points[0].x = points[0].x + dx;
                points[0].y = points[0].y + dy;

                Draw();

                game.CanEat();
                game.CheckBorder();
                Thread.Sleep(100);
            }
        }