Advertisement
g-stoyanov

ConsoleTextEffect

Mar 26th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. class Program
  5.     {
  6.         static void Main()
  7.         {
  8.             string text = Console.ReadLine();
  9.             for (int i = text.Length - 1; i >= 0; i--)
  10.             {
  11.                 if (text[i] != ' ')
  12.                 {
  13.                     int motionSpeed = (i + 20) * 2;
  14.                     for (int pos = 0; pos <= i + 20; pos++)
  15.                     {
  16.                         Console.SetCursorPosition(pos, 10);
  17.                         Console.Write(text[i]);
  18.                         Thread.Sleep(motionSpeed);
  19.                         if (pos != i + 20)
  20.                         {
  21.                             Console.SetCursorPosition(pos, 10);
  22.                             Console.Write(" ");
  23.                             motionSpeed = motionSpeed - 2;
  24.                         }
  25.                         else
  26.                         {
  27.                             DrawImpact(10, i + 20);
  28.                         }
  29.                     }
  30.                 }  
  31.             }
  32.  
  33.             Console.WriteLine();
  34.         }
  35.  
  36.         public static void DrawImpact(int row, int col)
  37.         {
  38.             Console.ForegroundColor = ConsoleColor.Yellow;
  39.             for (int i = 1; i <= 5; i++)
  40.             {
  41.                 Console.SetCursorPosition(col - i, row - i);
  42.                 Console.Write("\\{0}|{0}/", new string(' ', i - 1));
  43.                 Console.SetCursorPosition(col - i, row + i);
  44.                 Console.Write("/{0}|{0}\\", new string(' ', i - 1));
  45.                 Thread.Sleep(7);
  46.                 Console.SetCursorPosition(col - i, row - i);
  47.                 Console.WriteLine(new string(' ', ((i - 1)*2) + 3));
  48.                 Console.SetCursorPosition(col - i, row + i);
  49.                 Console.WriteLine(new string(' ', ((i - 1) * 2) + 3));
  50.             }
  51.  
  52.             Console.ResetColor();
  53.         }
  54.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement