Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- void punktyy(int *y, int *x, int *xp, int *ky , int *punkty=0)
- {
- if ((*y==19) && (*x>=*xp) && (*x<=*xp+4) ) //liczenie punktow void punkty
- {
- *ky = -1**ky;
- *punkty=*punkty+1;
- }
- }
- void ograniczenia(int *xp, int *kxp)
- {
- if((*xp>64) || (*xp<3)) //ograniczenia paletki
- {
- *kxp = -1**kxp;
- }
- *xp=*xp+*kxp;
- }
- void pilka(int *x, int *y, int *kx,int *ky)
- {
- if((*x>64) || (*x<3)) //ograniczenia pilki void pilka
- {
- *kx = -1*(*kx);
- }
- *x=*x+*kx;
- if ((*y>20) || (*y<3)) //ograniczenia pilki
- {
- *ky=-1*(*ky);
- }
- *y=*y+*ky;
- }
- void gotoxy (int x,int y)
- {
- COORD coord;
- coord.X=x;
- coord.Y=y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
- }
- void logo() //logo
- {
- cout << " _ " << endl;
- Sleep(50);
- cout << "| | " << endl;
- Sleep(50);
- cout << "| | ___ __ _ ___ " << endl;
- Sleep(50);
- cout << "| | / _ \\ / _ |/ _ \\ " << endl;
- Sleep(50);
- cout << "| |___| (_) | (_| | (_) | " << endl;
- Sleep(50);
- cout << "|______\\___/ \\__, |\\___/ " << endl;
- Sleep(50);
- cout << " __/ | " << endl;
- Sleep(50);
- cout << " |___/ " << endl;
- Sleep (2000);
- system("cls");
- }
- void menu()
- {
- cout<< " MENU" << endl;
- cout << "1. Graj" << endl;
- cout << "2. Inny Obrazek" << endl;
- cout << "3. Exit" << endl;
- cout << " Twoj wybor : ";
- int menu2;
- cin >> menu2;
- switch(menu2)
- {
- case 1:
- break;
- case 2:
- cout << ":'#######::'########::'########:::::'###::::'########:'########:'##:::'##:" << endl;
- Sleep(50);
- cout << "'##.... ##: ##.... ##: ##.... ##:::'## ##:::..... ##:: ##.....:: ##::'##:: " << endl;
- Sleep(50);
- cout << " ##:::: ##: ##:::: ##: ##:::: ##::'##:. ##:::::: ##::: ##::::::: ##:'##::: " << endl;
- Sleep(50);
- cout << " ##:::: ##: ########:: ########::'##:::. ##:::: ##:::: ######::: #####:::: " << endl;
- Sleep(50);
- cout << " ##:::: ##: ##.... ##: ##.. ##::: #########::: ##::::: ##...:::: ##. ##::: " << endl;
- Sleep(50);
- cout << " ##:::: ##: ##:::: ##: ##::. ##:: ##.... ##:: ##:::::: ##::::::: ##:. ##:: " << endl;
- Sleep(50);
- cout << ". #######:: ########:: ##:::. ##: ##:::: ##: ########: ########: ##::. ##: " << endl;
- Sleep(50);
- cout << ":.......:::........:::..:::::..::..:::::..::........::........::..::::..:: " << endl;
- Sleep (5000);
- exit(0);
- break;
- case 3:
- exit(0);
- break;
- }
- system("cls");
- }
- int main(int argc, char** argv)
- {
- logo();
- menu();
- int punkty=0;
- int kx=1, ky=1, kxp=1;
- char ee = 'q';
- int x =3;
- int y = 3;
- int xp = 3;
- char aa;
- aa = 218;
- gotoxy(1,1);
- cout << aa;
- aa = 217;
- gotoxy(70,22);
- cout << aa;
- aa = 191;
- gotoxy(70,1);
- cout << aa;
- aa = 192;
- gotoxy(1,22);
- cout << aa;
- aa = 196;
- for (int i = 2;i < 70; i++) //iksy x ramka
- {
- gotoxy (i,1);
- cout << aa;
- gotoxy(i,22);
- cout << aa << endl;
- }
- aa = 179;
- for (int j = 2;j < 22; j++ ) // igreki y ramka
- {
- gotoxy(1,j);
- cout << aa;
- gotoxy(70,j );
- cout << aa << endl;
- }
- while (ee =='q') //paletka
- {
- gotoxy (x,y);
- cout << "0"; //piłka
- gotoxy (xp,19);
- aa=196; //symbol znaku paletki
- cout<<aa<<aa<<aa<<aa<<aa;
- Sleep(30); //spowolnienie programu
- gotoxy (x,y);
- cout << " ";
- gotoxy (xp,19); //wysokosc paletki
- cout << " "; //spacje !!
- punktyy(&y,&x,&xp,&ky,&punkty);
- // if ((y==19) && (x>=xp) && (x<=xp+4) ) //liczenie punktow void punkty
- // {
- // ky = -1*ky;
- // punkty=punkty+1;
- // }
- ograniczenia (&xp,&kxp);
- // if((xp>64) || (xp<3)) //ograniczenia paletki
- // {
- // kxp = -1*kxp;
- // }
- // xp=xp+kxp;
- pilka (&x,&y,&kx,&ky);
- // if((x>66) || (x<3)) //ograniczenia pilki void pilka
- // {
- // kx = -1*kx;
- // }
- // x=x+kx;
- // if ((y>20) || (y<3)) //ograniczenia pilki
- // {
- // ky=-1*ky;
- // }
- // y=y+ky;
- char ch1;
- while (_kbhit()) //konczenie pracy programu
- {
- ch1 = _getch(); // konczenie klawiszem e
- if (ch1 =='e')
- {
- ee='e';
- }
- if (ch1=' ') //
- {
- kxp = -1*kxp;
- }
- }
- //punktacja
- gotoxy (75,10);
- cout << punkty << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement