Advertisement
Guest User

masz noobie

a guest
Mar 26th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <windows.h>
  4. using namespace std;
  5.  
  6. void punktyy(int *y, int *x, int *xp, int *ky , int *punkty=0)
  7. {
  8.     if ((*y==19) && (*x>=*xp) && (*x<=*xp+4) ) //liczenie punktow void punkty
  9.     {
  10.         *ky = -1**ky;
  11.         *punkty=*punkty+1;
  12.        
  13.     }
  14. }
  15.  
  16.  
  17. void ograniczenia(int *xp, int *kxp)
  18. {
  19.         if((*xp>64) || (*xp<3)) //ograniczenia paletki
  20.     {
  21.         *kxp = -1**kxp;
  22.        
  23.     }
  24.     *xp=*xp+*kxp;
  25. }
  26.  
  27.  
  28.  
  29. void pilka(int *x, int *y, int *kx,int *ky)
  30. {
  31.         if((*x>64) || (*x<3))  //ograniczenia pilki  void pilka
  32.     {
  33.         *kx = -1*(*kx);
  34.     }
  35.     *x=*x+*kx;
  36.     if ((*y>20) || (*y<3)) //ograniczenia pilki
  37.     {
  38.         *ky=-1*(*ky);
  39.     }
  40.     *y=*y+*ky;
  41. }
  42.  
  43.  
  44.  
  45.  
  46.  
  47. void gotoxy  (int x,int y)
  48. {
  49.     COORD coord;
  50.     coord.X=x;
  51.     coord.Y=y;
  52.     SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
  53. }
  54.  
  55.     void logo() //logo
  56. {
  57.     cout << " _                         " << endl;
  58.     Sleep(50);
  59.     cout << "| |                        " << endl;
  60.     Sleep(50);
  61.     cout << "| |     ___   __ _  ___    " << endl;
  62.     Sleep(50);
  63.     cout << "| |    / _ \\ / _  |/ _ \\   " << endl;
  64.     Sleep(50);
  65.     cout << "| |___| (_) | (_| | (_) |  " << endl;
  66.     Sleep(50);
  67.     cout << "|______\\___/ \\__, |\\___/   " << endl;
  68.     Sleep(50);
  69.     cout << "              __/ |        " << endl;
  70.     Sleep(50);
  71.     cout << "             |___/         " << endl;
  72.  
  73.    
  74.    
  75.     Sleep (2000);
  76.     system("cls");
  77. }
  78.     void menu()
  79.     {
  80.         cout<< " MENU"  << endl;
  81.         cout << "1. Graj" << endl;
  82.         cout << "2. Inny Obrazek" << endl;
  83.         cout << "3. Exit" << endl;
  84.         cout << " Twoj wybor : ";
  85.         int menu2;
  86.         cin >> menu2;
  87.        
  88.         switch(menu2)
  89.         {
  90.             case 1:                            
  91.                 break;
  92.             case 2:
  93.                 cout << ":'#######::'########::'########:::::'###::::'########:'########:'##:::'##:" << endl;
  94.                 Sleep(50);
  95.                 cout << "'##.... ##: ##.... ##: ##.... ##:::'## ##:::..... ##:: ##.....:: ##::'##::  " << endl;
  96.                 Sleep(50);
  97.                 cout << " ##:::: ##: ##:::: ##: ##:::: ##::'##:. ##:::::: ##::: ##::::::: ##:'##:::  " << endl;
  98.                 Sleep(50);
  99.                 cout << " ##:::: ##: ########:: ########::'##:::. ##:::: ##:::: ######::: #####::::  " << endl;
  100.                 Sleep(50);
  101.                 cout << " ##:::: ##: ##.... ##: ##.. ##::: #########::: ##::::: ##...:::: ##. ##:::  " << endl;
  102.                 Sleep(50);
  103.                 cout << " ##:::: ##: ##:::: ##: ##::. ##:: ##.... ##:: ##:::::: ##::::::: ##:. ##::  " << endl;
  104.                 Sleep(50);
  105.                 cout << ". #######:: ########:: ##:::. ##: ##:::: ##: ########: ########: ##::. ##:  " << endl;
  106.                 Sleep(50);
  107.                 cout << ":.......:::........:::..:::::..::..:::::..::........::........::..::::..::  " << endl;
  108.                
  109.                
  110.                 Sleep (5000);
  111.                 exit(0);
  112.                 break;
  113.             case 3:
  114.                 exit(0);
  115.                 break;
  116.                
  117.         }
  118.  
  119.         system("cls");
  120.     }
  121.    
  122.    
  123.  
  124.  
  125.  
  126. int main(int argc, char** argv)
  127. {
  128.    
  129.     logo();
  130.     menu();
  131.    
  132.     int punkty=0;
  133.     int kx=1, ky=1, kxp=1;
  134.    
  135.    
  136.     char ee = 'q';
  137.     int x =3;
  138.     int y = 3;
  139.     int xp = 3;
  140.    
  141.     char aa;
  142.     aa = 218;
  143.     gotoxy(1,1);
  144.     cout << aa;
  145.    
  146.     aa = 217;
  147.     gotoxy(70,22);
  148.     cout << aa;
  149.    
  150.     aa = 191;
  151.     gotoxy(70,1);
  152.     cout << aa;
  153.    
  154.     aa = 192;
  155.     gotoxy(1,22);
  156.     cout << aa;
  157.    
  158.     aa = 196;
  159.    
  160.         for (int i = 2;i < 70; i++) //iksy x ramka
  161.     {
  162.         gotoxy (i,1);
  163.         cout << aa;
  164.        
  165.         gotoxy(i,22);
  166.         cout << aa << endl;
  167.     }
  168.     aa = 179;
  169.     for (int j = 2;j < 22; j++ ) // igreki y ramka
  170.     {
  171.         gotoxy(1,j);
  172.         cout << aa;
  173.        
  174.         gotoxy(70,j );
  175.         cout << aa << endl;
  176.     }
  177.    
  178.     while (ee =='q') //paletka
  179.     {
  180.     gotoxy (x,y);
  181.     cout << "0"; //piłka
  182.     gotoxy (xp,19);
  183.     aa=196; //symbol znaku paletki
  184.     cout<<aa<<aa<<aa<<aa<<aa;
  185.    
  186.     Sleep(30); //spowolnienie programu
  187.    
  188.     gotoxy (x,y);
  189.     cout << " ";
  190.     gotoxy (xp,19); //wysokosc paletki
  191.     cout << "     "; //spacje !!
  192.    
  193.     punktyy(&y,&x,&xp,&ky,&punkty);
  194.    
  195.    
  196. //  if ((y==19) && (x>=xp) && (x<=xp+4) ) //liczenie punktow void punkty
  197. //  {
  198. //      ky = -1*ky;
  199. //      punkty=punkty+1;
  200.        
  201. //  }
  202.    
  203.     ograniczenia (&xp,&kxp);
  204. //  if((xp>64) || (xp<3)) //ograniczenia paletki
  205. //  {
  206. //      kxp = -1*kxp;
  207.        
  208. //  }
  209. //  xp=xp+kxp;
  210.    
  211.     pilka (&x,&y,&kx,&ky);
  212.    
  213. //  if((x>66) || (x<3))  //ograniczenia pilki  void pilka
  214. //  {
  215. //      kx = -1*kx;
  216. //  }
  217. //  x=x+kx;
  218.    
  219. //  if ((y>20) || (y<3)) //ograniczenia pilki
  220. //  {
  221. //      ky=-1*ky;
  222. //  }
  223. //  y=y+ky;
  224.  
  225.     char ch1;
  226.     while (_kbhit())  //konczenie pracy programu
  227.     {
  228.         ch1 = _getch();  // konczenie klawiszem e
  229.         if (ch1 =='e')
  230.         {
  231.             ee='e';
  232.         }
  233.         if (ch1=' ')  //
  234.         {
  235.             kxp = -1*kxp;
  236.         }
  237.     }
  238. //punktacja
  239.     gotoxy (75,10);
  240.     cout << punkty << endl;
  241.    
  242.        
  243.    
  244.    
  245.    
  246.     }
  247.    
  248.     return 0;
  249. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement