Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace BreakOut
- {
- class MyProgram
- {
- public void Run()
- {
- #region Platform
- for (int i = 45; i < 50; i++)
- {
- System.Threading.Thread.Sleep(15);
- Console.SetCursorPosition(i, 17);
- Console.Write("##");
- }
- #endregion
- #region walls
- for (int i = 100; i > 0; i--)
- {
- Console.SetCursorPosition(i, 1);
- Console.WriteLine("█");
- }
- for (int i = 17; i > 0; i--)
- {
- Console.SetCursorPosition(100, i);
- Console.WriteLine("█");
- }
- for (int i = 17; i > 0; i--)
- {
- Console.SetCursorPosition(1, i);
- Console.WriteLine("█");
- }
- #endregion
- #region Directions
- int posX = 5;
- int posY = 15;
- int directionX = 1;
- int directionY = 1;
- bool isRunning = true;
- while (isRunning)
- {
- Console.SetCursorPosition(posX, posY);
- Console.WriteLine(" ");
- posX = posX + directionX;
- if (posX <= 4 || posX >= 99)
- {
- directionX = directionX * -1;
- }
- Console.SetCursorPosition(posX, posY);
- Console.WriteLine("O");
- System.Threading.Thread.Sleep(5);
- Console.SetCursorPosition(posX, posY);
- Console.WriteLine(" ");
- posY = posY + directionY;
- if(posY <=2 || posY >=16)
- {
- directionY = directionY * -1;
- }
- Console.SetCursorPosition(posX, posY);
- Console.WriteLine("O");
- System.Threading.Thread.Sleep(100);
- }
- #endregion
- }
- #region Bricks
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement