コード例 #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);
            }
        }
コード例 #2
0
 private static void outConsole(DancingStar star, string s)
 {
     Console.SetCursorPosition(star.x, star.y);
     Console.Write(s);
 }
コード例 #3
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);
            }
        }
コード例 #4
0
 private static void outConsole(DancingStar star, string s)
 {
     Console.SetCursorPosition(star.x, star.y);
     Console.Write(s);
 }