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 *pkt=0)
- {
- if((*y==19)&&(*x>=*xp)&&(*x<=*xp+4))
- {
- *ky=-1**ky;
- *pkt=*pkt+1;
- }
- }
- void odbicie(int *x, int *y, int *kx,int *ky)
- {
- if((*x>68)||(*x<3))
- {
- *kx=-1*(*kx);
- }
- *x=*x+*kx;
- if((*y>20)||(*y<3))
- {
- *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 ()
- {
- int time=20;
- cout<<" ,--."""<<endl; Sleep (time);
- cout<<" __,----( o ))"<<endl; Sleep (time);
- cout<<" ,'--. , ( "<<endl; Sleep (time);
- cout<<" -"",:-( o ),-'/ ;"<<endl; Sleep (time);
- cout<<" ( o) `o _,'\ / ;("<<endl; Sleep (time);
- cout<<" `-;_-<'\_|-'/ ' )"<<endl; Sleep (time);
- cout<<" `.`-.__/ ' |"<<endl; Sleep (time);
- cout<<" \`. `. .__, ;"<<endl; Sleep (time);
- cout<<" )_;--. \` |"<<endl; Sleep (time);
- cout<<" /'(__,-: ) ;"<<endl; Sleep (time);
- cout<<" ;' (_,-: _,:: .|"<<endl; Sleep (time);
- cout<<" ; ( , ) _,':::' ,;"<<endl; Sleep (time);
- cout<<" ; )-,;' `:' .::"<<endl; Sleep (time);
- cout<<" | `' ; `:::\ "<<endl; Sleep (time);
- cout<<" : ,' ' `:\ "<<endl; Sleep (time);
- cout<<" ;: ' _,-': .' `-."<<endl; Sleep (time);
- cout<<" ';::..,' ' , ` ,__ `."<<endl; Sleep (time);
- cout<<" `;'' / ; _;_,-' `."<<endl; Sleep (time);
- cout<<" / _;--. \ "<<endl; Sleep (time);
- cout<<" ,' / ,' `. \ "<<endl; Sleep (time);
- cout<<" /: (_( ,' \ )"<<endl; Sleep (time);
- cout<<" /:. \_( /-. .:::,;/"<<endl; Sleep (time);
- cout<<" ;::::. \ __ "<<endl; Sleep (time);
- cout<<" ,::::::. .:' ) ,-' )"<<endl; Sleep (time);
- cout<<" / `;:::::::'`__,:.:::' /`---' ,'"<<endl; Sleep (time);
- cout<<" ; `""""' ( \:::' / _,-'"<<endl; Sleep (time);
- cout<<" ; \ \:' ,';:.,-'"<<endl; Sleep (time);
- cout<<" ( : )\ ("<<endl; Sleep (time);
- cout<<" `. \ \ ;"<<endl; Sleep (time);
- cout<<" `-.___ : ,\ \ ("<<endl; Sleep (time);
- cout<<" ,','._::::| \ \ \ \ "<<endl; Sleep (time);
- cout<<" (,(,---;;;;; \ \|;;;)"<<endl; Sleep (time);
- cout<<" `._\_\ "<<endl; Sleep (time);
- Sleep (2000);
- for(int j=40;j>=0;j--)
- {
- for(int i=70;i>=0;i--)
- {
- Sleep(0);
- gotoxy(i,j);
- cout <<" ";
- }
- }
- }
- void menu()
- {
- int wybor;
- cout<<"MENU GLOWNE"<<endl;
- cout<<"------------"<<endl;
- cout<<"1. Rozpocznij gre"<<endl;
- cout<<"2. Opusc gre"<<endl;
- cout<<"Wybor: ";cin>>wybor;
- switch (wybor)
- {
- case 1:
- {
- system ("CLS");
- break;
- }
- case 2:
- {
- exit (0);
- }
- }
- }
- int main(int argc, char** argv)
- {
- logo();
- menu();
- int x=3;
- int y=3;
- int xp=3;
- int kx=1, ky=1, kxp=1, pkt=0;
- char aa;
- aa=218;
- gotoxy(1,1);
- cout<<aa;
- aa=191;
- gotoxy(70,1);
- cout<<aa;
- aa=192;
- gotoxy(1,22);
- cout<<aa;
- aa=217;
- gotoxy(70,22);
- cout<<aa;
- aa=196;
- for (int i=2;i<70;i++)
- {
- gotoxy(i,1);
- cout<<aa;
- gotoxy(i,22);
- cout<<aa<<endl;
- }
- aa=179;
- for (int i=2;i<22;i++)
- {
- gotoxy(1,i);
- cout<<aa;
- gotoxy(70,i);
- cout<<aa<<endl;
- }
- char ee='q';
- while(ee=='q')
- {
- gotoxy(x,y);
- cout<<"o";
- gotoxy(xp,19);
- aa=196;
- cout<<aa<<aa<<aa<<aa<<aa;
- Sleep(50);
- gotoxy(x,y);
- cout<<" ";
- gotoxy(xp,19);
- cout<<" ";
- punktyy(&y,&x,&xp,&ky,&pkt);
- if((xp>64) || (xp<3))
- {
- kxp=-1*kxp;
- }
- xp=xp+kxp;
- odbicie(&x,&y,&kx,&ky);
- char ch1;
- while (_kbhit())
- {
- ch1=_getch();
- if (ch1=='e')
- {
- ee='e';
- }
- if (ch1=' ')
- {
- kxp=-1*kxp;
- }
- }
- gotoxy(75,10);
- cout<<punktyy<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement