USAComment.com
Mmm Zicutake USA Comment | Search Articles


#include #include #include #include #include class Galax { int i,j,k,l,m,i2,bios,chance,blink,shield,cho,x,y[30],p,q,score,speed,ran,r,zz,down,gunloc[11],mygun,active,active2,up,newspace,life,color,clash,out,cheat,right; char forpause,ch; float z,pos; public: int dash; Galax(); void clear(); void start(); void check(); void balls(); void showball(char); void boss(); void end(); void line(int); void hideline(int); void showface(); void move(); void square(); void bossgun(); void checkout(); void showlife(); void checkwin(); void intro(); void display(char tp[100]); }; Galax::Galax() { i=j=i2=ran=chance=blink=shield=cho=p=q=score=k=speed=r=down=active=active2=up=bios=newspace=clash=out=cheat=right=0; m=-1,dash=1,zz=35,z=40,x=40,y[30]=0,life=10,color=9; } void Galax::clear() { textcolor(WHITE); for(k=2;k<51;++k) { gotoxy(1,k); cprintf(" "); } if(dash==0) { for(i2=1;i2<80;++i2) { gotoxy(i2,49); cout<<"-"; } } gotoxy(1,1); } void Galax::start() { clear(); bios=0; gotoxy(37,25); cout<<"LEVEL ONE"; delay(2000); dash=0; clear(); dash=1; gotoxy(17,50); display("DODGE THE BULLETS!(YOUR GUN IS DEACTIVATED!)"); randomize(); start: q=0; ++chance; ++shield; gotoxy(x,48); cout<<"A"; if(chance==16) //change { clear(); gotoxy(37,25); cout<<"LEVEL TWO"; delay(2000); dash=0; clear(); dash=1; gotoxy(10,50); display("DON'T LET THE ROCK TOUCH YOU!(YOUR GUN IS DEACTIVATED)!"); for(m=0;m<10;m++) //changed to m as i,j,k,l are used { balls(); if(out==1) { delay(2000); blink=1; end(); } score+=50; } boss(); } r=0; //starting if(p==0) { for(i=0;i<30;++i) { ran: y[i]=random(80); if(y[i]==0||y[i]==1) goto ran; for(j=0;j>8; } else goto last; } switch(cho) { case 2: start(); break; case 3: clear(); cout<<" CONTROLS Move Left : Left Move Right : Right Dash 5 left : Ctrl + Left Dash 5 right : Ctrl + Right Speed up : Up Speed down : Down Shield : S or s * Fire : Space Pause/Resume : P or p Exit : Esc"; gotoxy(15,50); cout<<"* Activated only in LEVEL 1 after facing 5 bullets"; getch(); break; case 4: goto x; case 57: if((active==1)&&(newspace==0)) // newspace is for 2 spaces { //space mygun=x; active2=1; newspace=1; } break; case 75: if(q==1) { if(x>3) //left --x; } else if(q==0) { if(x>2) --x; } break; case 77: if(q==1) { if(x<78) //right ++x; } else if(q==0) { if(x<79) ++x; } break; case 115: if(q==1) { if(x>7) //cont+left x=x-5; } else if(q==0) { if(x>6) x=x-5; } break; case 116: if(q==1) { if(x<74) //cont+right x=x+5; } else if(q==0) { if(x<75) x=x+5; } break; case 25: gotoxy(35,25); //p or P cout<<"GAME PAUSED"; stop: forpause=getch(); if(forpause!=112&&forpause!=80) goto stop; gotoxy(35,25); cout<<" "; break; case 31: if(shield>5&&r!=1) //s or S { if(x==2) { x=3; } else if(x==79) { x=78; } // for shield shield=0; q=1; } break; case 80: if(speed<46) //down speed=speed+5; break; case 72: if(speed>-31) //up speed=speed-5; break; case 1: x: clear(); gotoxy(35,20); cout<<"Are You Sure..?? "; cout<<"Y N"; do{ if(bioskey(1)!=0) { cho=bioskey(0); cho=cho>>8; } } while(cho!=21&&cho!=49); if(cho==21) exit(0); if(bios!=1) { dash=0; clear(); dash=1; } if(chance<16&&chance>0) { gotoxy(17,50); cout<<"DODGE THE BULLETS!(YOUR GUN IS DEACTIVATED!)"; } if(m>=0&&m<10) { gotoxy(10,50); cout<<"DON'T LET THE FIRE BALL TOUCH YOU!(YOUR GUN IS DEACTIVATED)!"; } if(m==10) { gotoxy(10,50); cout<<"YOUR GUN IS ACTIVATED! HIT THE BOSS AND LOWER HIS LIFE!"; showlife(); } break; case 79: if(life>2) { cheat=1; color=1; //END key life=2; m=10; boss(); } break; default: break; } for(k=1;k<80;++k) { gotoxy(k,48); cout<<" "; } last: if(q==1&&r!=1) { gotoxy(x-1,48); cout<<"*A*"; } else if(bios!=1) { gotoxy(x,48); cout<<"A"; } } void Galax::showball(char ch) { for(j=i;j>=1;j--) //in i th line z-1 is min & z-i is max { if(i+1-j+(l-4)<=48) //condition for hiding part { if(j<=3) //first 3 lines { //l is for moving of the ball (see Galax2) gotoxy(z-j,i+1-j+(l-4)); //u will move j steps back for 2j+1 line for(k=1;k<=2*j+1;k++) cout<3&&j<=5) //if-else cases r made as pattern is 3,5,7,7,7,7,5,3 { gotoxy(z-3,i+1-j+(l-4)); for(k=0;k<7;k++) cout<5&&j<=8) { gotoxy(z-(9-j),i+1-j+(l-4)); //these r mathematically found values for(k=1;k<=19-2*j;k++) cout<2&&right==0) //right is made so that cheat knows where to go { zz--; check(); move(); } right=1; while(zz<69&&right==1) { zz++; check(); move(); } right=0; goto contd; } void Galax::line(int i) { gotoxy(zz,i); for(int j=0;j<11;j++) cout<<""; check(); delay(500); check(); } void Galax::hideline(int i) { gotoxy(zz,i); for(int j=0;j<11;j++) cout<<" "; gotoxy(zz,i+8); for(j=0;j<11;j++) cout<<""; check(); delay(500); check(); } void Galax::move() { for(int i=2;i<11;i++) { gotoxy(1,i); for(j=0;j<80;j++) cout<<" "; } square(); showface(); // rest is for gun if(down<38) down++; if(down==38) { checkout(); down=0; for(i=0;i<11;i++) gunloc[i]=zz+i; } if(up<37&&active2==1) up++; else if(up==37) { checkwin(); up=0; mygun=x; active2=0; newspace=0; } bossgun(); } void Galax::square() { textcolor(color); for(int j=3;j<11;j++) { gotoxy(zz,j); for (int i=0;i<11;i++) cprintf(""); } } void Galax::showface() { for(int l=4;l<6;l++) { for(int i=0;i<11;++i) if(i==2||i==3||i==4||i==6||i==7||i==8) { gotoxy(zz+i,l); cout<<" "; } } for(l=7;l<9;l++) { for(int i=0;i<11;++i) if(((i+l)%2==0)&&(i!=0)&&(i!=10)) { gotoxy(zz+i,l); cout<<" "; } } delay(100); check(); } void Galax::bossgun() { active=1; if((x>gunloc[5])&&(gunloc[10]<79)) for(int i=0;i<11;i++) gunloc[i]++; else if((x2)) for(int i=0;i<11;i++) gunloc[i]--; for(int i=0;i<11;i++) { gotoxy(gunloc[i],11+down); cout<<"|"; } if(active2==1) { clash=0; for(i=0;i<11;i++) { if((mygun==gunloc[i])&&((up+down==38)||(up+down==39))) { clash++; gotoxy(gunloc[i],11+down); cout<<" "; if(i!=10) gunloc[i]++; else gunloc[i]--; } } if(clash==0) { gotoxy(mygun,48-up); cout<<""; } else up=newspace=active2=0; } delay(50); check(); for(i=0;i<11;i++) { gotoxy(gunloc[i],11+down); cout<<" "; } if(active2==1) { gotoxy(mygun,48-up); cout<<" "; } } void Galax::checkout() { for(int j=0;j<11;j++) if((x==gunloc[j])&&(q==0)) end(); } void Galax::checkwin() { for(int j=0;j<11;j++) if(mygun==zz+j) { life--; if(life==9||life==5) color=6; else if(life==8||life==4) color=2; else if(life==7||life==3) color=4; else if(life==6||life==2) color=1; else color=0; textcolor(color); score+=100; } if(life==0) { score+=1000; end(); } showlife(); } void Galax::showlife() { gotoxy(33,1); for(j=0;j<20;j++) cout<<" "; gotoxy(33,1); cout<<"BOSS- "; for(int i=0;i

Nenhum comentário:

Postar um comentário