第三十五章 制作弹幕——“反魂蝶~八分咲~”

>>点此回到教程目录

弹幕:“反魂蝶~八分咲~”( 「反魂蝶~八部咲き~」)

制作难易度:★★★★★★ (6/10)


运行结果


↑点击这里观看包含音乐的高画质版本↑ (译者注:这是niconico的视频)


首先,如果您还没有理解激光的话,是没法做出反魂蝶的。因此还没有学习“试着制作激光吧”这一章节的读者,请先学习后再往下看。

……接下来上面激光的解说部分已经把我累坏了,这里的制作部分就让我稍微轻松一下吧。(汗)

void boss_shot_bulletH009(){
#define TM009 420
#define DIST 60
    int i,j,k,s,t=boss_shot.cnt%TM009,t2=boss_shot.cnt;
    double angle;
    static int num;
    if(t2==0)num=4;
    if(t==0){
        for(j=0;j<2;j++){
            for(i=0;i<num;i++){
                int plmn=(j ? -1 : 1);
                if((k=search_lazer())!=-1){
                    lazer[k].col      = j;//子弹的颜色
                    lazer[k].knd      = 0;//子弹的种类
                    lazer[k].angle    = PI2/num*i+PI2/(num*2)*j+PI2/(num*4)*((num+1)%2);//角度
                    lazer[k].startpt.x= boss.x+cos(lazer[k].angle)*DIST;//开始绘制的角度
                    lazer[k].startpt.y= boss.y+sin(lazer[k].angle)*DIST;
                    lazer[k].flag     = 1;//是否显示 0:否 1:是
                    lazer[k].cnt      = 0;
                    lazer[k].haba     = 2;//幅度
                    lazer[k].state    = j;//
                    lazer[k].length   = 240;//长度
                    lazer[k].hantei      = 0;//是否碰撞判定 0:是 1:否
                    lazer[k].lphy.conv_flag=1;//是否旋转 0:否 1:是
                    lazer[k].lphy.conv_base_x=boss.x;//旋转的基准坐标
                    lazer[k].lphy.conv_base_y=boss.y;
                    lazer[k].lphy.conv_x=lazer[k].startpt.x;//旋转的激光位置
                    lazer[k].lphy.conv_y=lazer[k].startpt.y;
                    input_lphy(&lazer[k],80,PI/num*plmn);//登录第k号激光在80次计数内只旋转PI/num*plmn角度的信息
                }
            }
        }
        se_flag[33]=1;
    }
    //60次计数一下每10次计数1次
    if(t==50){
        angle=rang(PI);//自机与Boss所成角度
        for(s=0;s<2;s++){
            for(t=0;t<3;t++){
                for(j=0;j<3;j++){
                    for(i=0;i<30;i++){
                        if((k=search_boss_shot())!=-1){
                            boss_shot.bullet[k].col   = s;//子弹的颜色
                            boss_shot.bullet[k].x     = boss.x;//坐标
                            boss_shot.bullet[k].y     = boss.y;
                            boss_shot.bullet[k].knd   = 11;//子弹的种类
                            boss_shot.bullet[k].angle = angle+PI2/30*i+PI2/60*s;//角度
                            boss_shot.bullet[k].flag  = 1;
                            boss_shot.bullet[k].cnt   = 0;
                            boss_shot.bullet[k].spd   = 1.8-0.2*j+0.1*s;//速度
                            boss_shot.bullet[k].eff   = 0;
                            boss_shot.bullet[k].state   = t;
                        }
                        se_flag[0]=1;
                    }
                }
            }
        }
    }
    if(t>=170 && t<310 && (t-170)%35==0){
        int div=((t-170)%70==0) ? -1 : 1;
        angle=rang(PI);//自机与Boss所成的角度
        for(s=0;s<2;s++){//有两类速度不同的子弹
            for(t=0;t<3;t++){//从一个地方一分为三
                for(i=0;i<30;i++){//1周30个
                    if((k=search_boss_shot())!=-1){
                        boss_shot.bullet[k].col   = 2;//子弹的颜色
                        boss_shot.bullet[k].x     = boss.x;//坐标
                        boss_shot.bullet[k].y     = boss.y;
                        boss_shot.bullet[k].knd   = 11;//子弹的种类
                        boss_shot.bullet[k].angle = angle+PI2/30*i;//角度
                        boss_shot.bullet[k].flag  = 1;
                        boss_shot.bullet[k].cnt   = 0;
                        boss_shot.bullet[k].spd   = 2-0.3*s;//速度
                        boss_shot.bullet[k].eff   = 0;
                        boss_shot.bullet[k].state = 10+t;
                        boss_shot.bullet[k].base_angle[0] = PI/300*div;
                    }
                }
            }
            se_flag[0]=1;
        }
    }
    if(t==360){
        angle=rang(PI);//自机与Boss所成的角度
        for(t=0;t<3;t++){//从一个地方一分为三
            for(i=0;i<30;i++){
                if((k=search_boss_shot())!=-1){
                    boss_shot.bullet[k].col   = 1;//子弹的颜色
                    boss_shot.bullet[k].x     = boss.x;//坐标
                    boss_shot.bullet[k].y     = boss.y;
                    boss_shot.bullet[k].knd   = 0;//子弹的种类
                    boss_shot.bullet[k].angle = angle+PI2/30*i;//角度
                    boss_shot.bullet[k].flag  = 1;
                    boss_shot.bullet[k].cnt   = 0;
                    boss_shot.bullet[k].spd   = 1.8;//速度
                    boss_shot.bullet[k].eff   = 1;
                    boss_shot.bullet[k].state = 20+t;
                }
            }
        }
        se_flag[0]=1;
    }
    for(i=0;i<BOSS_BULLET_MAX;i++){
        if(boss_shot.bullet[i].flag>0){
            int cnt=boss_shot.bullet[i].cnt;
            int state=boss_shot.bullet[i].state;
            if(state%10==0){
                if(cnt>90 && cnt<=100)
                    boss_shot.bullet[i].spd-=boss_shot.bullet[i].spd/220;
            }
            if(state%10==1){
                if(cnt>50)
                    boss_shot.bullet[i].spd+=boss_shot.bullet[i].spd/45;
            }
            if(state%10==2){
                if(cnt>65)
                    boss_shot.bullet[i].spd+=boss_shot.bullet[i].spd/90;
            }
            if(10<=state && state<=12){
                if(cnt>15 && cnt<=80)
                    boss_shot.bullet[i].angle+=boss_shot.bullet[i].base_angle[0];
            }
        }
    }
    for(i=0;i<LAZER_MAX;i++){
        if(lazer[i].flag>0){
            int cnt=lazer[i].cnt;
            int state=lazer[i].state;
            if(state==0 || state==1){
                if(cnt==80){
                    lazer[i].haba=30;
                    lazer[i].hantei=0.5;
                }
                if(cnt>=260 && cnt<=320){
                    if(cnt==280)
                        lazer[i].hantei=0;
                    lazer[i].haba=10*(60-(cnt-260))/60.0;
                    if(cnt==320)
                        lazer[i].flag=0;
                }
            }
        }
    }
    if(t==TM009-1)
        num=(++num);
}

>>点此回到教程目录

results matching ""

    No results matching ""