Example #1
0
        internal void Move()
        {
            Point tail = pointList.First();

            pointList.Remove(tail);
            Point head = GetNextPoint();

            pointList.Add(head);

            tail.Clear();
            head.Draw();

            if (_direction == Direction.UP || _direction == Direction.DOWN)
            {
                Thread.Sleep(VerticalSpeed);
            }
            else
            {
                Thread.Sleep(HorizontalSpeed);
            }
        }
Example #2
0
        internal bool Eat(Point food)
        {
            Point head     = GetNextPoint();
            Point tempFood = null;

            if (head.IsHit(food))
            {
                food.symbol = head.symbol;
                pointList.Add(food);
                Score.score += 1;

                for (int i = 0; i < pointList.Count; i++)
                {
                    if (!food.IsHit(pointList[i]))
                    {
                        if (head.IsHit(food))
                        {
                            if (!food.IsHit(GetNextPoint()))
                            {
                                head.Clear();
                                food.Draw();
                            }
                        }
                    }
                }
                if (HorizontalSpeed > 50)
                {
                    HorizontalSpeed -= 10;
                }
                if (VerticalSpeed > 100)
                {
                    VerticalSpeed -= 10;
                }
                tempFood = food;
                return(true);
            }
            return(false);
        }
Example #3
0
        internal void Move(int i)
        {
            Point tail = pLine.First();

            pLine.Remove(tail);
            Point head = GetNextPoint();

            //List<char> s = new List<char>();
            //s.Add('D');
            //s.Add('i');
            //s.Add('m');
            //s.Add('a');
            //s.Add('Z');
            //s.Add('o');
            //s.Add('R');
            //s.Add('i');
            //s.Add('n');
            //head.c = s[i];

            pLine.Add(head);

            tail.Clear();
            head.Draw();
        }