Created
February 29, 2016 07:15
-
-
Save olto/d8b795ea759b85106d16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void Main(string[] args) | |
| { | |
| int i = 0; | |
| int j = 0; | |
| int largeur = 21; | |
| int hauteur = 4; | |
| Console.WriteLine(@" .--------."); | |
| Console.WriteLine(@" ____/_____|___ \___"); | |
| Console.WriteLine(@"O _ - | _ ,*"); | |
| Console.WriteLine(@" '--(_)-------(_)--'"); | |
| while (true) | |
| { | |
| ConsoleKeyInfo info = Console.ReadKey(true); | |
| switch (info.Key) | |
| { | |
| case ConsoleKey.LeftArrow: | |
| if( i > 0 ) | |
| { | |
| Console.MoveBufferArea(i, j, largeur, hauteur, i - 1, j); | |
| i--; | |
| } | |
| break; | |
| case ConsoleKey.RightArrow: | |
| if (i < Console.WindowWidth - largeur) | |
| { | |
| Console.MoveBufferArea(i, j, largeur, hauteur, i + 1, j); | |
| i++; | |
| } | |
| break; | |
| case ConsoleKey.UpArrow: | |
| if( j > 0 ) | |
| { | |
| Console.MoveBufferArea(i, j, largeur, hauteur, i, j - 1); | |
| j--; | |
| } | |
| break; | |
| case ConsoleKey.DownArrow: | |
| Console.MoveBufferArea(i, j, largeur, hauteur, i, j + 1); | |
| j++; | |
| break; | |
| } | |
| if (info.Key == ConsoleKey.Q) | |
| break; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment