⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 110.c

📁 c语言版飞机闪射
💻 C
📖 第 1 页 / 共 2 页
字号:
      /* if((TimeS+1)%10==0&&P.LIFE<4)
              {A=TimeS/10;
              setfillstyle(0,0);
              bar(129,31,205,31);
              for(S=130,i=0;i<B+A;S+=24,i++);
                  {GB_TBF(S,1,&PLANE[0][0]);}
              P.LIFE++;
             }*/

      if((TimeS+1)%51==0)
        {


          if(P.LIFE==1)
          {setfillstyle(0,0);
           bar(129,31,205,31);
           GB_TBF(130+24,1,&PLANE[0][0]);
           B=2;
          }
            if(P.LIFE==2)
          {setfillstyle(0,0);
           bar(129,31,205,31);
           GB_TBF(130+24+24,1,&PLANE[0][0]);
           B=3;
          }
           if(P.LIFE==3)
           {
           setfillstyle(0,0);
           bar(129,31,205,31);
           GB_TBF(130+24+24+24,1,&PLANE[0][0]);
           B=4;
           }
        }
              /*p.hp<=0飞机消逝*/
           if(P.HP<=0)
        {
            bar(P.X1,P.Y1,P.X1+30,P.Y1+30);
            TRANSFORM("baozao.tbf",&baoza[0][0]);
            /*加载TBF图片*/
            GB_TBF(P.X1,P.Y1,&baoza[0][0]);
            setcolor(RED);
            outtextxy(250,220,"Please wait...!");


            B--;

            sleep(2);
            goto start ;
        }
        /*一键加血*/
        if(GetKey(KEY_H))
        {
            P.HP=P.HP+(100-P.HP);
            DISPLAY_HP(P.HP);
        }
        /*遇一物体加血
        TRANSFORM("hp.tbf",&hp[0][0]);
        if(!(P.X1+15>=hp_x[n]&&P.X1+15<=hp_x[n]+30&&P.Y1+15>=hp_y&&P.Y1+15<=hp_y+30)&&hp_y<430)
        {
            hp_y+=2 ; GB_TBF(hp_x[n],hp_y,&hp[0][0]);
        }


        setfillstyle(0,0);
        delay(5000);
        bar(hp_x[n],hp_y,hp_x[n]+30,hp_y+30);*/
        
        if(P.X1+15>=hp_x[n]&&P.X1+15<=hp_x[n]+30&&P.   Y1+15>=hp_y&&P.Y1+15<=hp_y+30)
        {

            P.HP=P.HP+(100-P.HP);
            DISPLAY_HP(P.HP);

        }
        
        /*初始化一颗子弹*/
        for(n=0;n<BULLET_SUM;n++)
        {
            if(EB[n].RUN==0)
            {
                i=Xrand(1,5);
                /*确定敌人子弹的启始点 4种可能性*/
                if(i==1)
                {
                    EB[n].PX=Xrand(41,599);
                    EB[n].PY=41 ;
                }
                else if(i==2)
                {
                    EB[n].PX=Xrand(41,599);
                    EB[n].PY=439 ;
                }
                else if(i==3)
                {
                    EB[n].PX=41 ;
                    EB[n].PY=Xrand(41,439);
                }
                else if(i==4)
                {
                    EB[n].PX=599 ;
                    EB[n].PY=Xrand(41,439);
                }
                else 
                continue ;
                EB[n].oa=ASK_a(EB[n].PX,EB[n].PY,P.X1+16,P.Y1+16);
                /*确定敌人子弹的目标点*/
                EB[n].RUN=1 ;
            }
        }
        setfillstyle(0,0);
        /*飞机方向控制*/
        if(GetKey(KEY_UP))
        {
            P.Y1-=PLAYER;
            if(P.Y1<=25)
            {
                P.Y1=P.Y1+PLAYER;
            }
        }
        if(GetKey(KEY_DOWN))
        {
            P.Y1+=PLAYER;
            if(P.Y1>455)
            {
                P.Y1=P.Y1-PLAYER;
            }
        }
        if(GetKey(KEY_RIGHT))
        {
            P.X1+=PLAYER;
            if(P.X1>630)
            {
                P.X1=P.X1-PLAYER;
            }
        }
        if(GetKey(KEY_LEFT))
        {
            P.X1-=PLAYER;
            if(P.X1<1)
            {
                P.X1=P.X1+PLAYER;
            }
        }

        
        
        
        
        if(GetKey(KEY_ESC))
        flag=1 ;
        if(TimeDelayUnit(1.0))
        {
            setfillstyle(1,0);
            bar(503,7,503+80,7+19);
            /*擦去上一次时间显示*/
            setcolor(10);
            TimeS++;
            if(TimeS==60)
            {
                /*满60秒是一分钟*/
                TimeS=0 ;
                TimeM++;
            }
            /*时间显示*/
            sprintf(TM,"%02d",TimeM);
            outtextxy(506,10,TM);
            outtextxy(536,10,":");
            sprintf(TS,"%02d",TimeS);
            outtextxy(551,10,TS);
            
            
        }
        bar(P.X0,P.Y0,P.X0+30,P.Y0+30);
        /*擦去飞机上次图片*/
        GB_TBF(P.X1,P.Y1,&PLANE[0][0]);
        P.X0=P.X1 ;
        P.Y0=P.Y1 ;
        
    }
    
    
    
    floodfill(0,0,3);
    gotoxy(45,56);
    printf("are you want to exit!");
    sleep(1);
    exit(0);
    getch();
}
/*************************************************8*/


/**************************************************************88*/

/*主函数*/
main()
{
    int y1=189,y2=206,key,a,D=150;
    int f_x=195,f_y,f_x1=230,f_y1,V_Y=149 ;
    int PLANE[30][30];
    char TS[20000];
    char*fly ;
    char*name ;
    name="002.bmp" ;
    map(name);
    AGAIN :;
    initmap();
    setcolor(8);
    /*进入按扭*/
    rectangle(295,185,345,210);
    setfillstyle(SOLID_FILL,8);
    floodfill(296,186,8);
    setcolor(7);
    rectangle(295,185,343,208);
    setfillstyle(SOLID_FILL,7);
    floodfill(296,186,7);
    setcolor(24);
    rectangle(297,187,343,208);
    setfillstyle(SOLID_FILL,24);
    floodfill(298,188,24);
    setcolor(2);
    settextstyle(0,0,1);
    outtextxy(302,195,"START");
    setcolor(8);
    /*退出按扭*/
    rectangle(295,215,345,240);
    setfillstyle(SOLID_FILL,8);
    floodfill(296,216,8);
    setcolor(7);
    rectangle(295,215,343,238);
    setfillstyle(SOLID_FILL,7);
    floodfill(296,216,7);
    setcolor(24);
    rectangle(297,217,343,238);
    setfillstyle(SOLID_FILL,24);
    floodfill(298,218,24);
    setcolor(2);
    settextstyle(0,0,1);
    outtextxy(304,224,"EXIT");
    setcolor(8);
    /*帮助按扭*/
    rectangle(295,245,345,270);
    setfillstyle(SOLID_FILL,8);
    floodfill(296,246,8);
    setcolor(7);
    rectangle(295,245,343,268);
    setfillstyle(SOLID_FILL,7);
    floodfill(296,246,7);
    setcolor(24);
    rectangle(297,247,343,268);
    setfillstyle(SOLID_FILL,24);
    floodfill(298,248,24);
    setcolor(2);
    settextstyle(0,0,1);
    outtextxy(304,254,"HELP");
    setcolor(8);
    /*作者按扭*/
    rectangle(295,275,345,300);
    setfillstyle(SOLID_FILL,8);
    floodfill(296,276,8);
    setcolor(7);
    rectangle(295,275,343,298);
    setfillstyle(SOLID_FILL,7);
    floodfill(296,276,7);
    setcolor(24);
    rectangle(297,277,343,298);
    setfillstyle(SOLID_FILL,24);
    floodfill(298,278,24);
    setcolor(2);
    settextstyle(0,0,1);
    outtextxy(301,285,"MAKER");
    /*****************************/
    setcolor(0);
    rectangle(299,189,341,206);
    setcolor(0);
    rectangle(299,219,341,236);
    setcolor(0);
    rectangle(299,249,341,266);
    rectangle(299,279,341,296);
    settextstyle(0,0,3);
    setcolor(2);
    outtextxy(100,30,"WELCOM TO THIS GAME");
    setcolor(RED);
    outtextxy(200,80,"GOOD LUCK !");
    setcolor(2);
    settextstyle(0,0,2);
    outtextxy(230,110,"QQ:182378175");
    outtextxy(150,140,"email:xmmarmy007@163.com");
    setcolor(2);
    rectangle(299,y1,341,y2);

    
    while(1)
    {
        key=bioskey(0);
        /*菜单控制*/
        
        if(key==DOWN)
        {
            setcolor(0);
            rectangle(299,y1,341,y2);
            y1=y1+30 ;
            y2=y2+30 ;
            setcolor(2);
            rectangle(299,y1,341,y2);
            
            if(y1>279)
            {
                
                setcolor(0);
                rectangle(299,y1,341,y2);
                y1=189 ;
                y2=206 ;
                setcolor(2);
                rectangle(299,y1,341,y2);
            }
        }
        if(key==UP)
        {
            setcolor(0);
            rectangle(299,y1,341,y2);
            y1-=30 ;
            y2-=30 ;
            setcolor(2);
            rectangle(299,y1,341,y2);
            if(y1<189)
            {
                setcolor(0);
                rectangle(299,y1,341,y2);
                y1=279 ;
                y2=296 ;
                setcolor(2);
                rectangle(299,y1,341,y2);
            }
        }
        if(key==ENTER)
        {
            if(y1==189)
            {
                closegraph();
                fast();
                setcolor(2);
                settextstyle(0,0,1);
                /*加载飞机图1*/
                TRANSFORM("xmm.tbf",&PLANE[0][0]);
                GB_TBF(200,170,&PLANE[0][0]);
                /*加载飞机图片2*/
                TRANSFORM("PLANE.tbf",&PLANE[0][0]);
                GB_TBF(250,170,&PLANE[0][0]);
                /*加载飞机图片3*/
                TRANSFORM("f45.tbf",&PLANE[0][0]);
                GB_TBF(300,170,&PLANE[0][0]);
                /*速度框*/
                setcolor(2);
                rectangle(400,50,415,150);
                setcolor(YELLOW);
                setcolor(YELLOW);
                outtextxy(395, 35,"150");
                line(402,V_Y,413,V_Y);

                /*选择提示*/
                setcolor(2);
                settextstyle(0,0,1);
                outtextxy(100,200,"please use 'right' and 'left' for choose a kind of plane!");
                outtextxy(150,215,"and use'up'and 'down' for change fast!");
                outtextxy(150,230,"and press 'esc' to return!");
                outtextxy(300,245,"CHINA GOOD!");
                outtextxy(300,265,"USA");
                outtextxy(300,285,"ENGLISH");
                setcolor(RED);
                outtextxy(300,325,"GO ON !");
                /*说明飞机性能*/
                setcolor(2);
                settextstyle(0,0,1);
                outtextxy(250,50,"ADDRESS:");
                outtextxy(250,70,"HP: ");
                outtextxy(250,90,"V:");
                outtextxy(250,110,"GJ:");
                outtextxy(250,130,"NAME:");

                setcolor(RED);
                outtextxy(315,50,"USA");
                outtextxy(275,70,"100 ");
                outtextxy(270,90,"360M/S");
                outtextxy(275,110,"1500");
                outtextxy(295,130,"F-16");

                setcolor(2);
                rectangle(f_x,170,f_x1,197);

                while(1)
                {
                    key=bioskey(0);
                    
                    if(key==RIGHT)
                    {
                        setcolor(0);
                        rectangle(f_x,170,f_x1,197);
                        f_x+=52 ;
                        f_x1+=52 ;
                        setcolor(2);
                        rectangle(f_x,170,f_x1,197);
                        if(f_x>=347)
                        {
                            setcolor(0);
                            rectangle(f_x,170,f_x1,197);
                            f_x=195 ;
                            f_x1=230 ;
                            setcolor(2);
                            rectangle(f_x,170,f_x1,197);
                        }
                    }
                    if(key==LEFT)
                    {
                        setcolor(0);
                        rectangle(f_x,170,f_x1,197);
                        f_x-=52 ;
                        f_x1-=52 ;
                        setcolor(2);
                        rectangle(f_x,170,f_x1,197);
                        if(f_x<195)
                        {
                            setcolor(0);
                            rectangle(f_x,170,f_x1,197);
                            f_x=299 ;
                            f_x1=334 ;
                            setcolor(2);
                            rectangle(f_x,170,f_x1,197);
                        }
                    }
                    /*调整速度*/
                   if(key==UP)
                      {
                       if(V_Y>51)
                          {
                          setcolor(YELLOW);
                          line(402,V_Y,413,V_Y);
                          V_Y-=1;
                          D=(150-V_Y)*150;
                          }
                      }
                   if(key==DOWN)
                      {
                       if(V_Y<149)
                          {

                          setcolor(0);
                          line(402,V_Y,413,V_Y);
                          V_Y+=1;
                          D=(150-V_Y)*150;
                          }
                      }
                     setfillstyle(0,0);
                     bar(378,32,450,48);
                    setcolor(YELLOW);
                    sprintf(TS, "%d", D);
                    outtextxy(395, 35, TS);
                   if(key==ESC)
                      {
                      closegraph();
                      goto AGAIN ;
                      }
                    
                    if(f_x==195)
                    {
                        
                        setfillstyle(0,0);
                        bar(240,50,380,160);
                        settextstyle(0,0,1);
                        setcolor(2);
                        outtextxy(250,50,"ADDRESS:");
                        outtextxy(250,70,"HP: ");
                        outtextxy(250,90,"V:");
                        outtextxy(250,110,"GJ:");
                        outtextxy(250,130,"NAME:");
                        setcolor(RED);
                          outtextxy(315,50,"USA");
                        outtextxy(275,70,"100 ");
                        outtextxy(270,90,"500M/S");
                        outtextxy(275,110,"1500");
                        outtextxy(295,130,"F-16");

                        
                        
                    }
                    if(f_x1==282)
                    {
                        
                        setfillstyle(0,0);
                        bar(240,50,380,160);
                        settextstyle(0,0,1);
                        setcolor(2);
                        outtextxy(250,50,"ADDRESS:");
                        outtextxy(250,70,"HP: ");
                        outtextxy(250,90,"V:");
                        outtextxy(250,110,"GJ:");
                        outtextxy(250,130,"NAME:");
                        setcolor(RED);
                          outtextxy(315,50,"CHINA");
                        outtextxy(275,70,"100 ");
                        outtextxy(270,90,"900M/S");
                        outtextxy(275,110,"2000");
                        outtextxy(295,130,"FC-7");

                    }
                    if(f_x==299)
                    {
                        
                        setfillstyle(0,0);
                        bar(240,50,380,160);
                        settextstyle(0,0,1);
                        setcolor(2);
                        outtextxy(250,50,"ADDRESS:");
                        outtextxy(250,70,"HP: ");
                        outtextxy(250,90,"V:");
                        outtextxy(250,110,"GJ:");
                        outtextxy(250,130,"NAME");

                        setcolor(RED);
                        outtextxy(315,50,"ENGLISH");
                        outtextxy(275,70,"100 ");
                        outtextxy(270,90,"400M/S");
                        outtextxy(275,110,"1800");
                        outtextxy(295,130,"S-45");

                    }
                    if(key==ENTER)
                    {
                        if(f_x==195)
                        {
                            
                            fly="xmm.tbf" ;
                            run(fly,7,D);
                        }
                        
                        
                        if(f_x1==282)
                        {
                            
                            fly="PLANE.TBF" ;
                            run(fly,10,D);
                        }
                        if(f_x1==334);
                        {
                            fly="f45.tbf" ;
                            run(fly,4,D);
                        }
                        
                    }
                    
                    
                }
            }

            else if(y1==219)
            {
                
                exit(0);
            }
            else if(y1==249)
            {
                closegraph();
                
                name="help.bmp" ;
                map(name);
                closegraph();
                
                goto AGAIN ;
            }
            else if(y1==279)
            {
                closegraph();
                name="make.bmp" ;
                map(name);
                closegraph();
                delay(5000);
                goto AGAIN ;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -