Advertisement
Guest User

bojo

a guest
Nov 18th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <windows.h>
  4. #include <cstdlib>
  5. #include <time.h>
  6. using namespace std;
  7.  
  8. /// plansza 40 x 20
  9.  
  10. HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE);
  11.  
  12. int faza = 1;
  13.  
  14. int x = 11;
  15. int y = 5;
  16. int x1 = 10;
  17. int y1 = 3;
  18. int x2 = 30;
  19. int y2 = 10;
  20. int x3 = 15;
  21. int y3 = 16;
  22.  
  23. void gotoxy(int x, int y)
  24. {
  25.     COORD c;
  26.     c.X = x-1;
  27.     c.Y = y-1;
  28.     SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), c);
  29. }
  30.  
  31. void pole()
  32. {
  33.     system("cls");
  34.     SetConsoleTextAttribute(con, 255);
  35.     for(int i=0; i<42; i++)
  36.     {
  37.         cout<<" ";
  38.     }
  39.     for(int i=2; i<22; i++)
  40.     {
  41.         cout<<endl<<" ";
  42.         gotoxy(42, i);
  43.         cout<<" ";
  44.     }
  45.     cout<<endl;
  46.     for(int i=0; i<17; i++)
  47.     {
  48.         cout<<" ";
  49.     }
  50.     for(int i=0; i<17; i++)
  51.     {
  52.         gotoxy(i+26, 22);
  53.         cout<<" ";
  54.     }
  55.     gotoxy(17, 23);
  56.     cout<<" ";
  57.     gotoxy(17, 24);
  58.     cout<<"          ";
  59.     gotoxy(26, 23);
  60.     cout<<" ";
  61.     SetConsoleTextAttribute(con, 10);
  62.     gotoxy(x1, y1);
  63.     cout<<"o";
  64.     gotoxy(x1, y1+1);
  65.     cout<<"+";
  66.     gotoxy(x1, y1+2);
  67.     cout<<"^";
  68.     gotoxy(x2, y2);
  69.     cout<<"o";
  70.     gotoxy(x2, y2+1);
  71.     cout<<"+";
  72.     gotoxy(x2, y2+2);
  73.     cout<<"^";
  74.     gotoxy(x3, y3);
  75.     cout<<"o";
  76.     gotoxy(x3, y3+1);
  77.     cout<<"+";
  78.     gotoxy(x3, y3+2);
  79.     cout<<"^";
  80.     SetConsoleTextAttribute(con, 15);
  81.     gotoxy(x, y);
  82.     cout<<"o";
  83.     if(faza == 1)
  84.     {
  85.         gotoxy(x1-2, y1-1);
  86.         cout<<"Ramos";
  87.     }
  88.     else if(faza == 2)
  89.     {
  90.         gotoxy(x2-2, y2-1);
  91.         cout<<"Kante";
  92.     }
  93.     else if(faza == 3)
  94.     {
  95.         gotoxy(x3-3, y3-1);
  96.         cout<<"Ronaldo";
  97.     }
  98.  
  99. }
  100.  
  101.  
  102.  
  103. int main()
  104. {
  105.     pole();
  106.     y++;
  107.     Sleep(200);
  108.     pole();
  109.     for(int i=0; i<6; i++)
  110.     {
  111.         for(int j=0; j<3; j++)
  112.         {
  113.             x++;
  114.             Sleep(200);
  115.             pole();
  116.         }
  117.         y++;
  118.         pole();
  119.     }
  120.     faza = 2;
  121.     pole();
  122.     x--;
  123.     Sleep(200);
  124.     pole();
  125.     for(int i=0; i<6; i++)
  126.     {
  127.         y++;
  128.         Sleep(200);
  129.         pole();
  130.         for(int j=0; j<2; j++)
  131.         {
  132.             x--;
  133.             Sleep(200);
  134.             pole();
  135.         }
  136.     }
  137.     faza = 3;
  138.     pole();
  139.     for(int i=0; i<4; i++)
  140.     {
  141.         for(int j=0; j<2; j++)
  142.         {
  143.             x++;
  144.             Sleep(200);
  145.             pole();
  146.         }
  147.         y++;
  148.         Sleep(200);
  149.         pole();
  150.     }
  151.     x++;
  152.     Sleep(200);
  153.     pole();
  154.     y++;
  155.     Sleep(200);
  156.     pole();
  157.  
  158.  
  159.     gotoxy(1, 25);
  160.     SetConsoleTextAttribute(con, 15);
  161.  
  162.  
  163.     /// Bartosz Kowalski 2019
  164.  
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement