Example #1
0
        private static void goStar(int X, int Y)
        {
            DancingStar star = new DancingStar(X, Y);

            while (true)
            {
                outConsole(star, " "); //cleaning old *

                int h = rand.Next(4);  //generate the direction

                switch (h)
                {
                case 0:
                    star.goDown();
                    break;

                case 1:
                    star.goUp();
                    break;

                case 2:
                    star.goLeft();
                    break;

                case 3:
                    star.goRight();
                    break;
                }

                outConsole(star, "*");      //out
                Thread.Sleep(100);
            }
        }
 private static void outConsole(DancingStar star, string s)
 {
     Console.SetCursorPosition(star.x, star.y);
     Console.Write(s);
 }
        private static void goStar(int X, int Y)
        {
            DancingStar star = new DancingStar(X, Y);
            while (true)
            {
                outConsole(star, " "); //cleaning old *

                int h = rand.Next(4);   //generate the direction

                switch (h)
                {
                    case 0:
                        star.goDown();
                        break;
                    case 1:
                        star.goUp();
                        break;
                    case 2:
                        star.goLeft();
                        break;
                    case 3:
                        star.goRight();
                        break;
                }

                outConsole(star, "*");      //out
                Thread.Sleep(100);
            }
        }
Example #4
0
 private static void outConsole(DancingStar star, string s)
 {
     Console.SetCursorPosition(star.x, star.y);
     Console.Write(s);
 }