My photo
Bangalore, Karnataka, India
Extending one hand to help someone has more value rather than joining two hands for prayer

Archives

project of shooting game

Tuesday, September 1, 2009

#include<iostream.h>
#include<alloc.h>
#include<dos.h>
#include<conio.h>
#include<stdlib.h>;
#include<graphics.h>
void front_page();
void second_page();
void final_page();
    long o=0,g=0,a=20;
    float v;
    char w;
void main()
{    int gde=DETECT,gme;
    initgraph(&gde,&gme,"c:\\tc");
    mit:           //label
    front_page();
    w=getch();
    switch(w)
    {    case '1':v=1.2; break;
        case '2':v=2.0; break;
        case '3':v=5; break;
        default: goto mit;
    }
    cleardevice();
    int c=0;
    char *h;
    second_page();
    int maxx,maxy,area,x=580,ch,xdirn=1,ydirn=1;
    float y=25;
    void *buff;
    setcolor(WHITE);
    setfillstyle(SOLID_FILL,RED );
    circle(605,50,25);
    floodfill(605,50,WHITE);
    area=imagesize(580,25,630,75);
    buff=malloc(area);
    getimage(580,25,630,75,buff);
    maxx=getmaxx();
    maxy=getmaxy();
    while(1)
    {    putimage(x,y,buff,XOR_PUT);
        //delay(0);
        y=y+(ydirn*v);
        putimage(x,y,buff,XOR_PUT);
        if(y>maxy-50||y<20)
        {    c=0;
            sound(130);
            delay(5);
            nosound();
            ydirn*=-1;
        }
        int marea,m=98,n=235,ch,mdirn=1,ndirn=1,mn;
        int maxm,maxn,narea,buffn;
        void *buffe;
        setcolor(DARKGRAY);
        setfillstyle(SOLID_FILL,DARKGRAY );
        rectangle(98,235,105,239);
        floodfill(101,237,DARKGRAY);
        marea=imagesize(98,235,105,239);
        buffe=malloc(marea);
        getimage(98,235,105,239,buffe);
        maxm=getmaxx();
        maxn=getmaxy();
        gotoxy(2,10);
        int in;
        cout<<"BULLETS REMAINING = ";
        for(in=0;in<=a-1;in++)
        {    cout<<"!";
        }
        if(kbhit())
        {    mn=getch();
            char *bul;
            if(a==0)
            break;
            if((mn==115||mn==83) &&c==0)
            {    a=a-1;
                cout<<0;
                sound(9999);
                delay(10);
                c++;
                nosound();
                while(m<=maxm)
                {    putimage(m,n,buffe,XOR_PUT);
                    m=m+(mdirn*2);
                    delay(0);
                    putimage(m,n,buffe,XOR_PUT);
                    gotoxy(11,3);
                    cout<<g;
                    if(m==maxm-51 && (y<=235 && y+25>=205))
                    {    g=g+10;
                        o=g;
                        sound(2200);
                        delay(900);
                        putimage(700,25,buff,XOR_PUT);
                        nosound();
                    }
                }
            }
            else
            {    if(mn==27)
                break;
            }
        }
    }
    cleardevice();
    final_page();
    getch();
    closegraph();
}
void front_page()
{    setbkcolor(GREEN);
    setcolor(WHITE);
    setfillstyle(SOLID_FILL,RED );
    circle(505,190,50);
    floodfill(505,190,WHITE);
    setcolor(BROWN);
    line(0,235,35,235);
    line(0,235,0,258);
    line(35,240,35,235);
    line(0,258,35,240);
    setfillstyle(1,BROWN);
    floodfill(2,240,BROWN);
    setcolor(DARKGRAY);
    line(35,235,102,235);
    line(35,240,35,235);
    line(35,240,102,240);
    line(102,235,102,240);
    setfillstyle(1,DARKGRAY);
    floodfill(99,236,DARKGRAY);
    arc(35,220,250,310,25);
    line(35,242,38,243);
    settextstyle(1,0,1);
    setcolor(BLUE);
    outtextxy(200,300,"MADE BY :- MOHIT VASHISHT");
    outtextxy(200,317,"E_MAIL   :- mohitvashisht88@yahoo.com");
    settextstyle(4,0,5);
    outtextxy(200,50,"SHOOTING");
    outtextxy(250,120,"GAME");
    gotoxy(20,12);
    cout<<" 1 : EASY";
    gotoxy(20,13);
    cout<<" 2 : MEDIUM";
    gotoxy(20,14);
    cout<<" 3 : TOUGH";
    gotoxy(10,16);
    cout<<"ENTER THE LEVEL = ";
}
void second_page()
{    setcolor(BROWN);
    setbkcolor(YELLOW);
    line(0,235,35,235);
    line(0,235,0,258);
    line(35,240,35,235);
    line(0,258,35,240);
    setfillstyle(1,BROWN);
    floodfill(2,240,BROWN);
    setcolor(DARKGRAY);
    line(35,235,102,235);
    line(35,240,35,235);
    line(35,240,102,240);
    line(102,235,102,240);
    setfillstyle(1,DARKGRAY);
    floodfill(99,236,DARKGRAY);
    arc(35,220,250,310,25);
    line(35,242,38,243);
    outtextxy(10,35,"SCORE");
    outtextxy(10,50,"FIRE");
    outtextxy(50,50,"S");
    outtextxy(10,65,"EXIT");
    outtextxy(50,65,"esc");
}
void final_page()
{    setcolor(BROWN);
    setbkcolor(RED);
          for(int x=1;x<=4;x++)
    {
        clrscr();
        setbkcolor(RED);
        delay(100);
        gotoxy(31,12);
        cout<<"YOUR SCORE = "<<o;
        sound(2200);
        delay(750);
        nosound();
    }
    gotoxy(28,16);
    cout<<"PRESS ANY KEY TO EXIT";
}

4 comments:

Anonymous said...

respected sir,
it's a fantastic program, i think a genius had made it. thanx

Upinder Singh Dhami said...

Apni tareef de anne pull v na bann mr mohit

ASHUTOSH AGGARWAL said...

upinder paji tuhade kol OOPS de program ghat hai,main pa dva OOPS de program as i have few of operator overloading, inheritence,constructor destructor etc and few others.....

Anonymous said...

sure sir, we will waiting for ur valuable programs