Exemple #1
0
 public override void Draw(int ticks)
 {
     this.X++;
     if (this.X > 20)
     {
         this.X = 10;
     }
     if (ticks % 2 == 0)
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if (i >= j && i >= 6 - j)
                 {
                     Engine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Yellow);
                 }
             }
         }
     }
     else
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if (i <= j && i <= 6 - j)
                 {
                     Engine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Blue);
                 }
             }
         }
     }
 }
Exemple #2
0
 public override void Draw(int ticks)
 {
     this.X++;
     if (this.X > 40)
     {
         this.X = 30;
     }
     if (ticks % 2 == 1)
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if (j >= i)
                 {
                     Engine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Green);
                 }
             }
         }
     }
     else
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if (j <= i)
                 {
                     Engine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Cyan);
                 }
             }
         }
     }
 }
Exemple #3
0
        public override void Draw(int ticks)
        {
            this.X++;
            if (this.X > 70)
            {
                this.X = 10;
            }

            if (ticks % 2 == 1)
            {
                Engine2D.SetPixel(this.X - 1, this.Y - 1, this.Color);
                Engine2D.SetPixel(this.X + 1, this.Y - 1, this.Color);
                Engine2D.SetPixel(this.X - 1, this.Y + 1, this.Color);
                Engine2D.SetPixel(this.X + 1, this.Y + 1, this.Color);
                Engine2D.SetPixel(this.X, this.Y, this.Color);
            }
            else
            {
                Engine2D.SetPixel(this.X - 1, this.Y, this.Color);
                Engine2D.SetPixel(this.X + 1, this.Y, this.Color);
                Engine2D.SetPixel(this.X, this.Y - 1, this.Color);
                Engine2D.SetPixel(this.X, this.Y + 1, this.Color);
                Engine2D.SetPixel(this.X, this.Y, this.Color);
            }
        }
Exemple #4
0
 public override void Draw(int ticks)
 {
     this.X++;
     if (this.X > 30)
     {
         this.X = 20;
     }
     if (ticks % 2 == 1)
     {
         for (int i = 0; i < 5; i++)
         {
             for (int j = 0; j < 5; j++)
             {
                 Engine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.White);
             }
         }
     }
     else
     {
         for (int i = 1; i <= 5; i++)
         {
             for (int j = 1; j <= 5; j++)
             {
                 if ((j >= i && j >= 6 - i) || (j <= i && j <= 6 - i))
                 {
                     Engine2D.SetPixel(this.X + i, this.Y + j, this.Color = ConsoleColor.Red);
                 }
             }
         }
     }
 }
Exemple #5
0
 public override void Draw(int ticks)
 {
     Engine2D.SetPixel(this.X - 1, this.Y, this.Color);
     Engine2D.SetPixel(this.X + 1, this.Y, this.Color);
     Engine2D.SetPixel(this.X, this.Y - 1, this.Color);
     Engine2D.SetPixel(this.X, this.Y + 1, this.Color);
     Engine2D.SetPixel(this.X, this.Y, this.Color);
 }
Exemple #6
0
 public static void Draw(IEnumerable <Shape> shapes)
 {
     while (true)
     {
         Engine2D.Clear();
         foreach (var shape in shapes)
         {
             shape.Draw(Ticks);
         }
         Thread.Sleep(250);
         Ticks++;
     }
 }
Exemple #7
0
        static void Main(string[] args)
        {
            Engine2D.Draw(
                new Shape[]
            {
                //new Star(2, 2, ConsoleColor.Red),
                //new Star(10, 10, ConsoleColor.White),
                //new AniStar(20, 20, ConsoleColor.Blue),
                new Triangle(50, 10),
                new Rectangle(50, 10),
                new Square(50, 10)
            });

            Console.Read();
        }