Paste Description for Hero - The Game
http://www.bin-co.com/cpp/
- Hero - The Game
- Thursday, February 28th, 2008 at 4:49:10am MST
- #include<stdio.h>
- #include<conio.h>
- #include<process.h>
- #include<stdlib.h>
- #include<dos.h>
- static int min=1;
- static int sec=59;
- static int micro=59;
- static int col=2;
- static int col1=76;
- static int row=9;
- static int row5=5;
- static int row13=13;
- static int row17=17;
- static int row21=21;
- int b=5;
- int crow1=3,ccol1=2;
- char cha[25][80];
- void intro();
- void arrow();
- void main(void)//date completed ( 11 / 9 / 2007 Sep )
- {
- char ch,get;
- int row,row1;
- const int ESC=27,LEFT=75,RIGHT=77,UP=72,DOWN=80;
- int a;
- int score1=0;
- clrscr();
- intro();
- clrscr();
- for(int i=0;i<25;i++)
- for(int j=0;j<80;j++)
- cha[i][j]='y';
- textbackground(14); textcolor(11);
- gotoxy(6,1);cprintf(" SCORE : LAST TIME : CHANCE : EXIT : Esc ");
- textbackground(0);
- textcolor(RED);
- gotoxy(1,2);cprintf("ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»");
- textcolor(14);
- gotoxy(1,3);cprintf("¯");
- gotoxy(80,23);cprintf("¯");
- textcolor(RED);
- for(row=4;row<=24;row++)
- {
- gotoxy(1,row);cprintf("º");
- }
- for(row1=3;row1<=22;row1++)
- {
- gotoxy(80,row1);cprintf("º");
- }
- gotoxy(1,24);cprintf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ");
- textcolor(2);
- textbackground(0);
- gotoxy(2,4); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(16,4);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(42,4);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(68,4);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,6); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(28,6);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(54,6);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,8); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(16,8);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(42,8);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(68,8);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,10); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(28,10);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(54,10);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,12); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(16,12);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(42,12);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(68,12);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,14); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(28,14);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(54,14);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,16); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(16,16);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(42,16);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(68,16);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,18); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(28,18);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(54,18);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,20); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(16,20);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(42,20);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(68,20);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(2,22); cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(28,22);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
- gotoxy(54,22);cprintf("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛb");
- //--------------------------------------------------------------------
- textcolor(13);
- gotoxy(5,3);cprintf ("");
- gotoxy(2,7);cprintf ("");
- gotoxy(2,11);cprintf ("");
- gotoxy(2,15);cprintf ("");
- gotoxy(2,19);cprintf ("");
- gotoxy(2,23);cprintf ("");
- do
- {
- arrow();
- ch=getch();
- textcolor(0);textbackground(0);
- gotoxy(ccol1,crow1);cprintf("Ûb");
- if(ch==RIGHT&& ccol1!=79 && (crow1!=4 && crow1!=6 && crow1!=8 && crow1!=10 && crow1!=12 && crow1!=14 && crow1!=16 && crow1!=18 && crow1!=20 && crow1!=22) )
- {
- ccol1++;
- }
- if(ch==LEFT && ccol1!= 2 && (crow1!=4 && crow1!=6 && crow1!=8 && crow1!=10 && crow1!=12 && crow1!=14 && crow1!=16 && crow1!=18 && crow1!=20 && crow1!=22))
- {
- ccol1--;
- }
- if(ch==DOWN && crow1!=23)
- {
- if((crow1==3 || crow1==4 || crow1==7 || crow1==8 || crow1==11 || crow1==12 || crow1==15 || crow1==16 || crow1==19 || crow1==20) && (ccol1==15 || ccol1==41 || ccol1==67))
- {
- crow1++;
- }
- if((crow1==5 || crow1==6 || crow1==9 || crow1==10 || crow1==13 || crow1==14 || crow1==17 || crow1==18 || crow1==21 || crow1==22) && (ccol1==27 || ccol1==53))
- {
- crow1++;
- }
- }
- if(ch==UP && crow1!= 3)
- {
- if((crow1==4 || crow1==5 || crow1==8 || crow1==9 || crow1==12 || crow1==13 || crow1==16 || crow1==17 || crow1==20|| crow1==21) && (ccol1==15 || ccol1==41 || ccol1==67))
- {
- crow1--;
- }
- if((crow1==6 || crow1==7 || crow1==10 || crow1==11 || crow1==14 || crow1==15 || crow1==18 || crow1==19 || crow1==22|| crow1==23) && (ccol1==27 || ccol1==53))
- {
- crow1--;
- }
- }
- if( (crow1==3) && ((ccol1>=5) && (ccol1<=79)) || (crow1==7) && ((ccol1>=2) && (ccol1<=79)) || (crow1==11) && ((ccol1>=2) && (ccol1<=79)) || (crow1==15) && ((ccol1>=2) && (ccol1<=79)) || (crow1==19) && ((ccol1>=2) && (ccol1<=79)) || (crow1==23) && ((ccol1>=2) && (ccol1<=79)))
- {
- if(cha[crow1][ccol1]=='y')
- {
- cha[crow1][ccol1]='n';
- score1++;
- }
- }
- if( (crow1==23 && ccol1==79) )
- {
- gotoxy(20,11);printf(" ");
- gotoxy(20,12);printf(" CONGRATULATION ");
- gotoxy(20,13);printf(" ");
- gotoxy(20,14);printf(" YOUR SCORE %0.3d ",score1);
- gotoxy(20,15);printf(" ");
- gotoxy(20,16);printf(" GAME OVER ");
- gotoxy(20,17);printf(" ");
- getch();
- getch();
- exit(1);
- }
- textcolor(14); textbackground(6);
- gotoxy (15,1); cprintf("%03d",score1);
- gotoxy (58,1); cprintf(" %02d",b);
- textbackground (0);
- textcolor(15);
- gotoxy(ccol1,crow1);cprintf("Ûb");
- }while(ch!=ESC);
- clrscr();
- }
- //---------------------------------------------------------
- void arrow( )
- {
- static int a=1;
- do
- {
- //--------------------Time ---------------------
- micro--;
- if(micro==0)
- {
- micro=60;
- sec--;
- }
- if(sec==0)
- {
- sec=60;
- min--;
- }
- if( (min==0) || (b==0))
- {
- gotoxy(20,9); printf (" ");
- gotoxy(20,10);printf (" Sorry You Have to go to exit ");
- gotoxy(20,11);printf (" ");
- gotoxy(20,12);printf (" Press Any Key to Exit ");
- gotoxy(20,14);printf (" ");
- getch();
- getch();
- exit(1);
- }
- gotoxy(35,1);printf("%02d:%02d:%02db",min,sec,micro);
- //----------------Arrow ---------------------------
- if(a==1)
- {
- textcolor(0);
- gotoxy (col,row5 ); cprintf(" ");
- gotoxy (col1,row ); cprintf(" ");
- gotoxy (col,row13); cprintf(" ");
- gotoxy (col1,row17); cprintf(" ");
- gotoxy (col,row21); cprintf(" ");
- col++;col1--;textcolor(15);
- gotoxy (col,row5 ); cprintf("--->");
- gotoxy (col1,row ); cprintf("===");
- gotoxy (col,row13); cprintf("--->");
- gotoxy (col1,row17); cprintf("---");
- gotoxy (col,row21); cprintf("--->");
- delay(10);
- if( (col==76) && (col1==2))a=0;
- }
- if(a==0)
- {
- textcolor(0);
- gotoxy (col,row5 ); cprintf(" ");
- gotoxy (col1,row ); cprintf(" ");
- gotoxy (col,row13); cprintf(" ");
- gotoxy (col1,row17); cprintf(" ");
- gotoxy (col,row21); cprintf(" ");
- col--;col1++;textcolor(15);
- gotoxy (col,row5 ); cprintf("<---");
- gotoxy (col1,row ); cprintf("===");
- gotoxy (col,row13); cprintf("<---");
- gotoxy (col1,row17); cprintf("---");
- gotoxy (col,row21); cprintf("<---");
- delay(10);
- if(col==2)a=1;
- }
- if( ((col1==ccol1) && (row==crow1)) || ((col==ccol1) && (row5==crow1)) || ((col==ccol1)&& (row13==crow1)) || ((col1==ccol1)&& (row17==crow1))|| ((col==ccol1)&& (row21==crow1)))
- {
- b--;
- sound(1000);
- delay(1000);
- nosound();
- ccol1=2;
- crow1=3;
- micro=59;min=1;sec=59;
- }
- delay(8);
- }while(!kbhit());
- }
- //--------------------------------------------------------------------------
- void intro()
- {
- gotoxy(35,1);printf("786");
- textbackground(14);
- textcolor(2);
- gotoxy(20,5);cprintf(" W E L L C O M E ");
- textbackground(0);
- gotoxy(20,8);cprintf(" T H E - H E R O - G A M E ");
- textbackground(0);
- textcolor(15);
- gotoxy(7,12);cprintf(" COMPOSED BY : ");
- textbackground(10);
- textcolor(9+150);
- gotoxy(20,14);cprintf(" S A J I D A L I T U N I O bb ");
- gotoxy(40,16);cprintf("[Group Leader]");
- textbackground(1);
- textcolor(9+150);
- gotoxy(20,18);cprintf("Members:");
- gotoxy(20,20);cprintf("Majid Ali Soomro ");
- gotoxy(20,21);cprintf("Ali Hassan Gorar ");
- gotoxy(20,22);cprintf("Rashid Ali ");
- gotoxy(20,23);cprintf("Raja Jamshed ");
- getch();
- textbackground(0); textcolor(15);
- }
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.