#東方弾幕風[Stage]
#Title[★Anotherレミリアステージ]
#Text[ver1.5  開始時Slowキー：
　　　　グレイズ回収OFF
　　　　開始時Userキー：
　　　　ボスをレミリアで固定

残機数で難易度変化
奇数×100000000点でボム取得
道中2000HIT以上でボス一部強化]
#Image[.\img\SS.png]
#Player[FREE]
#ScriptVersion[2]
#BackGround[Default]
#BGM[]

script_stage_main
{
    let Z=0;//毎フレーム増える
    let ZZ=0;
    let Z11=0;//雑用
    let Z12=0;
    let gra=0;
    let gra2=0;
    let gra3=0;
    let gra4=0;

    let color=0;//色代入

    let gu1=0;
    let gu2=0;
    let gu3=0;
    let gu4=0;
    let gu5=0;//ITEM COLLECT OFF
    let gu6=0;//ANOTHER BOSS OFF
    let gu7=0;
    let gu8=0;
    let gu9=0;
    let gu10=0;

    let cx=GetCenterX();
    let cy=GetCenterY();
    let ac=0;
    let ze=0;
    let col=0;
    let col2=0;
    let count=0;
    let BGstep=0;
    let Yspeed=0;
    let Yspeed2=0;
    let SlowMove=0;
    let BGG00=0;
    let BGG01=0;
    let BGG02=0;
    let BGG03=255;
    let BGG04=0;
    let BGG05=0;
    let BGG06=0;
    let BGG07=0;
    let BGG08=0;
    let BGG09=0;
    let BGG10=0;//ハイスコア保存
    let BGG11=0;
    let BGG12=0;
    let BGG13=0;
    let BGG14=0;
    let BGG15=0;
    let BGG16=255;
    let BGG17=0;
    let BGG18=0;
    let BGG19=0;
    let BGG20=0;
    let BGG21=0;
    let BGG22=0;
    let BGG23=250;
    let ura=0;
    let ma=0;//低速エフェクト
    let xUP=250;
    let xBOMB=100000000;
    let pass=GetCurrentScriptDirectory~"Spell.dat";
    let BG=100;
    let stage=0;
    let Dark=0;
    let mo=255;
    let mo2=255;
    let Level=0;
    let Mode=0;
    let uprr=0;
    let borr=0;
    let uprr2=0;
    let borr2=0;
    let uprr3=0;
    let borr3=0;
    let uprrS=0;
    let borrS=0;
    let replay=0;
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN01.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN01+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN02.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN02+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN03.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN03+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN04.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN04+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN05.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN05+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN06.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN06+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN07.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN07+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi02.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi03.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi04.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi01+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi02+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi03+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi04+.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi06.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi06++.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi07.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Remi09.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiEvent.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy02.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy07.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy08.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy10.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy11.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy12.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy14.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"rFraN01.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"rFra02.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"rFra01.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"rFraEvent.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant00.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant01.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant02.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant03.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant04.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant102.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"firstEvent.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"firstEvent2.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"firstEvent3.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Missile.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Missile2.txt");
    CompileEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt");

    task combo()
    {
        let alpha = 0;
        let obj = Obj_Create(OBJ_EFFECT);
        Obj_SetX(obj, -69);
        Obj_SetY(obj, 51);
        Obj_SetSpeed(obj, 0);
        ObjEffect_SetTexture(obj, GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        ObjEffect_SetRenderState(obj, ALPHA);
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
        ObjEffect_SetScale(obj,0.8,1.02);
        ObjEffect_SetAngle(obj,0,0,0);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetLayer(obj,3);

        //四角形状に各頂点のUV値を設定
        ObjEffect_SetVertexUV(obj,0,140,18);
        ObjEffect_SetVertexUV(obj,1,152,18);
        ObjEffect_SetVertexUV(obj,2,152,78);
        ObjEffect_SetVertexUV(obj,3,140,78);

        while (!Obj_BeDeleted(obj))
        {

            //四角形状に各頂点の座標を設定
            ObjEffect_SetVertexXY(obj,0,152,77-gu2);
            ObjEffect_SetVertexXY(obj,1,140,77-gu2);
            ObjEffect_SetVertexXY(obj,2,152,78);
            ObjEffect_SetVertexXY(obj,3,140,78);

            if (gu2<20) {
                ascent(let t in 0..4) {
                    ObjEffect_SetVertexColor(obj,t,(125+(mo2/2)),155,0,200);
                }
            }

            if (gu2>=20) {
                ascent(let t in 0..4) {
                    ObjEffect_SetVertexColor(obj,t,(125+(mo2/2)),200,0,0);
                }
            }

            if (gu2>=60&&gra>=3) {
                ascent(let t in 0..4) {
                    ObjEffect_SetVertexColor(obj,t,(125+(mo2/2)),230,0,0);
                }
            }

            if (gu2>=60&&count%3<1&&gra>=3) {
                ascent(let t in 0..4) {
                    ObjEffect_SetVertexColor(obj,t,(125+(mo2/2)),255,225,195);
                }
            }

            if (gu4>0) {
                ascent(let t in 0..4) {
                    ObjEffect_SetVertexColor(obj,t,(125+(mo2/2)),145,145,145);
                }
            }

            yield;
        }

    }

    task itemg()
    {
        let alpha = 0;
        let obj = Obj_Create(OBJ_EFFECT);
        Obj_SetX(obj, 605);
        Obj_SetY(obj, 193);
        Obj_SetSpeed(obj, 0);
        ObjEffect_SetTexture(obj, GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        ObjEffect_SetRenderState(obj, ALPHA);
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
        ObjEffect_SetScale(obj,1,1);
        ObjEffect_SetAngle(obj,0,0,0);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetLayer(obj,8);

        //四角形状に各頂点のUV値を設定
        ObjEffect_SetVertexUV(obj,0,176,352);
        ObjEffect_SetVertexUV(obj,1,176,384);
        ObjEffect_SetVertexUV(obj,2,192,384);
        ObjEffect_SetVertexUV(obj,3,192,352);

        while (!Obj_BeDeleted(obj))
        {

            //四角形状に各頂点の座標を設定
            ObjEffect_SetVertexXY(obj,0,0,0);
            ObjEffect_SetVertexXY(obj,1,0,32);
            ObjEffect_SetVertexXY(obj,2,16,32);
            ObjEffect_SetVertexXY(obj,3,16,0);

            ascent(let t in 0..4) {
                ObjEffect_SetVertexColor(obj,t,255,255,255,255);
            }

            if (uprr2<=0) {
                Obj_Delete(obj);
            }

            yield;
        }

    }

    task itemg2()
    {
        let alpha = 0;
        let obj = Obj_Create(OBJ_EFFECT);
        Obj_SetX(obj, 629);
        Obj_SetY(obj, 211);
        Obj_SetSpeed(obj, 0);
        ObjEffect_SetTexture(obj, GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        ObjEffect_SetRenderState(obj, ALPHA);
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
        ObjEffect_SetScale(obj,0.5,0.5);
        ObjEffect_SetAngle(obj,0,0,0);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetLayer(obj,8);

        while (!Obj_BeDeleted(obj))
        {

            //四角形状に各頂点の座標を設定
            ObjEffect_SetVertexXY(obj,0,-10,-19);
            ObjEffect_SetVertexXY(obj,1,-10,19);
            ObjEffect_SetVertexXY(obj,2,10,-19);
            ObjEffect_SetVertexXY(obj,3,10,19);

            //四角形状に各頂点のUV値を設定
            ObjEffect_SetVertexUV(obj,0,164+24*uprr,128);
            ObjEffect_SetVertexUV(obj,1,164+24*uprr,166);
            ObjEffect_SetVertexUV(obj,2,184+24*uprr,128);
            ObjEffect_SetVertexUV(obj,3,184+24*uprr,166);

            ascent(let t in 0..4) {
                ObjEffect_SetVertexColor(obj,t,255,255,255,255);
            }

            if (uprr2<=0) {
                Obj_Delete(obj);
            }

            yield;
        }

    }

    task bombg()
    {
        let alpha = 0;
        let obj = Obj_Create(OBJ_EFFECT);
        Obj_SetX(obj, 605);
        Obj_SetY(obj, 227);
        Obj_SetSpeed(obj, 0);
        ObjEffect_SetTexture(obj, GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        ObjEffect_SetRenderState(obj, ALPHA);
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
        ObjEffect_SetScale(obj,1,1);
        ObjEffect_SetAngle(obj,0,0,0);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetLayer(obj,8);

        //四角形状に各頂点のUV値を設定
        ObjEffect_SetVertexUV(obj,0,176,352);
        ObjEffect_SetVertexUV(obj,1,176,384);
        ObjEffect_SetVertexUV(obj,2,192,384);
        ObjEffect_SetVertexUV(obj,3,192,352);

        while (!Obj_BeDeleted(obj))
        {

            //四角形状に各頂点の座標を設定
            ObjEffect_SetVertexXY(obj,0,0,0);
            ObjEffect_SetVertexXY(obj,1,0,32);
            ObjEffect_SetVertexXY(obj,2,16,32);
            ObjEffect_SetVertexXY(obj,3,16,0);

            ascent(let t in 0..4) {
                ObjEffect_SetVertexColor(obj,t,255,255,255,255);
            }

            if (borr2<=0||borrS!=0) {
                Obj_Delete(obj);
            }

            yield;
        }

    }

    task bombg2()
    {
        let alpha = 0;
        let obj = Obj_Create(OBJ_EFFECT);
        Obj_SetX(obj, 629);
        Obj_SetY(obj, 245);
        Obj_SetSpeed(obj, 0);
        ObjEffect_SetTexture(obj, GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        ObjEffect_SetRenderState(obj, ALPHA);
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
        ObjEffect_SetScale(obj,0.5,0.5);
        ObjEffect_SetAngle(obj,0,0,0);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetLayer(obj,8);

        while (!Obj_BeDeleted(obj))
        {

            //四角形状に各頂点の座標を設定
            ObjEffect_SetVertexXY(obj,0,-10,-19);
            ObjEffect_SetVertexXY(obj,1,-10,19);
            ObjEffect_SetVertexXY(obj,2,10,-19);
            ObjEffect_SetVertexXY(obj,3,10,19);

            //四角形状に各頂点のUV値を設定
            ObjEffect_SetVertexUV(obj,0,164+24*borr,128);
            ObjEffect_SetVertexUV(obj,1,164+24*borr,165);
            ObjEffect_SetVertexUV(obj,2,184+24*borr,128);
            ObjEffect_SetVertexUV(obj,3,184+24*borr,165);

            ascent(let t in 0..4) {
                ObjEffect_SetVertexColor(obj,t,255,255,255,255);
            }

            if (borr2<=0||borrS!=0) {
                Obj_Delete(obj);
            }

            yield;
        }

    }


    task StageTask
    {
        function Wait(let frame) {
            loop(frame) {
                yield
            };
        }
        function WaitForZeroEnemy() {
            while (GetEnemyNum() != 0) {
                yield;
            }
        }
        task tama1() {
            loop(6) {
                Wait(32);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+32,480,0,0,2);
            }
        }
        task tama2() {
            loop(6) {
                Wait(32);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-32,480,0,0,3);
            }
        }
        task tama3(l,d) {
            loop(l) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-125-d,470,6,280,0);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+125+d,470,6,260,0);
            }
        }
        task tama3a(l,d) {
            loop(l) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-125-d,470,6,280,3);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+125+d,470,6,260,4);
            }
        }
        task tama3b(l,d) {
            loop(l) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-55-d+rand(-65,265),470+rand(-25,155),rand(6,8),280,3);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+55+d+rand(-265,65),470+rand(-25,155),rand(6,8),260,4);
            }
        }
        task tama4(l) {
            loop(l) {
                Wait(13);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+265,310,6.6,180+44,1);
            }
        }
        task tama5(l) {
            loop(l) {
                Wait(13);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-265,310,6.6,0-44,2);
            }
        }

        task tama6(l) {
            loop(l) {
                Wait(25);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant11.txt",cx-23,-22,0,0,5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant11.txt",cx+26,-22,0,0,5);
            }
        }

        task z3(x,y,a) {
            loop(8) {
                Wait(20);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+x,y,1.5,a,4);
            }
        }
        task hayaokuri(l) {
            loop(l) {
                count++;
                Wait(1);
            }
        }
        task ame{loop(225) {
            BGG18+=1;
            Wait(1);
        }}
        task tuki{loop(800) {
            BGG09++;
            Wait(1);
        }}
        task onmyo() {
            loop(4) {
                Wait(180);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy07.txt",cx-140*sin(Z),-110+rand(0,-20),0,0,0);
            }
        }
        task tt() {
            loop(1) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",cx+rand(-115,-130),-60,0,0,15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",cx+126,-187,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",cx+rand(115,130),-60,0,0,15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",cx-126,-187,0,0,1);
            }
            loop(4) {
                Wait(30);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",cx+rand(-15,-20),-60,0,0,15);
                Wait(30);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",cx+rand(15,20),-60,0,0,15);
            }
        }
        task tank(s,l) {
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s,0,0,0);
                Wait(16);
            }Wait(60);
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s,0,0,0);
                Wait(16);
            }
        }
        task tankl(s,l) {
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s,0,0,0);
                Wait(16);
            }Wait(60);
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s,0,0,0);
                Wait(16);
            }
        }
        task tank2(s,l) {
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s,0,0,0);
                Wait(16);
            }Wait(30);
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s,0,0,0);
                Wait(16);
            }
        }
        task tank2l(s,l) {
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx-300,s,0,0,0);
                Wait(16);
            }Wait(30);
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s+70,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+300,s,0,0,0);
                Wait(16);
            }
        }
        task yousei(s,l,y) {
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+255,y+rand(10,-10),0,0,7);
                Wait(s);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-255,y+rand(10,-10),0,0,7);
                Wait(s);
            }
        }
        task yousei2(s,l,y,x) {
            loop(l) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-304-x,y,0,0,8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+304+x,y,0,0,8);
                Wait(s);
            }
        }

        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy02.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy07.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy08.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy10.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy11.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy12.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Enemy14.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"rFraN01.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"rFra01.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN01.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant00.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant01.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant02.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant03.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant04.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Servant102.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"firstEvent.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"firstEvent2.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"firstEvent3.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Missile.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Missile2.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN05.txt");
        CompileEnemyFromFile(GetCurrentScriptDirectory~"RemiN05+.txt");

        if (GetCommonDataDefault("Go",0)<=0) {
            ForbidShot(true);
            ForbidBomb(true);
            SetPlayerX(GetCenterX);
            SetPlayerY(380);
            SetCommonData("Go",1);
            SetCommonDataEx("Spell","HighScore",0);
        }

        Wait(1);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+888,-62,0,0,13);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+888,-262,0,0,13);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy00.txt",cx+888,-62,0,0,13);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy11.txt",cx+888,-62,0,0,13);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy12.txt",cx+888,-62,0,0,13);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy14.txt",cx+888,600,0,0,0);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant02.txt",cx+888,-292,0,0,4);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",cx+888,-152,0,0,3);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",cx+888,-152,0,0,4);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant102.txt",cx+888,-152,0,0,3);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Missile.txt",cx+888,-152,0,0,2);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",cx+888,-152,0,0,2);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Missile2.txt",cx+888,-152,0,0,2);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"RemiN05.txt",cx+888,-388,0,0,0);

        Z11=255;

        loop(40) {
            Wait(1);
            ForbidShot(true);
            ForbidBomb(true);
            SetPlayerX(GetCenterX);
            SetPlayerY(380);
	    if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
	 	gu5=255;
	    }
	    else{
		gu5=0;
	    }
	    if(GetKeyState(VK_USER)==KEY_HOLD){
	        gu6=255;
	    }
	    else{
		gu6=0;
	    }
        }


        while (GetCommonDataDefault("Go",0)>0) {
            ForbidShot(true);
            ForbidBomb(true);
            SetPlayerX(GetCenterX);
            SetPlayerY(380);

	    if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
	 	gu5=255;
	    }
	    else{
		gu5=0;
	    }
	    if(GetKeyState(VK_USER)==KEY_HOLD){
	        gu6=255;
	    }
	    else{
		gu6=0;
	    }
            if (GetKeyState(VK_SHOT)==KEY_PUSH) {
                PlaySE(GetCurrentScriptDirectory~"\se\se002-0023.wav");
                SetCommonData("Go",0);
            }
            yield;
        }

	if(gu5>0){
	    gu5=250;
	    ze=1;
	}
	if(gu6>0){
	    gu6=250;
	    col=1;
	}

        loop(12) {
            Wait(1);
            ForbidShot(true);
            ForbidBomb(true);
            SetPlayerX(GetCenterX);
            SetPlayerY(380);
            SetCommonDataEx("Spell","HighScore",0);
            Z11-=30;
        }

        combo;

        loop(40) {
            Wait(1);
            ForbidShot(true);
            ForbidBomb(true);
            SetPlayerX(GetCenterX);
            SetPlayerY(380);
            SetCommonDataEx("Spell","HighScore",0);
        }

        loop(51) {
            Wait(1);
            ForbidShot(true);
            ForbidBomb(true);
	    gu5-=5;
	    gu6-=5;
            Z12-=5;
            BGG16-=5;
            SetCommonDataEx("Spell","HighScore",0);
        }

        ForbidShot(false);
        ForbidBomb(false);

        if (GetPlayerType()==REIMU_A || GetPlayerType()==REIMU_B || GetPlayerType()==MARISA_A || GetPlayerType()==MARISA_B) {
            BGG06=1;
        }

        count=0;Z=0;ZZ=0;Z11=0;Z12=0;
        PlaySE(GetCurrentScriptDirectory~"\se\metal.wav");
        CreateEnemyFromFile(GetCurrentScriptDirectory~"firstEvent.txt",cx,-60,0,0,0);
        SetCommonDataEx("Spell","HighScore",0);

        //Wait(25);
        SetCommonData("Mode",2);

        WaitForZeroEnemy();

        //Wait(10);
        Z=-90;

        Yspeed2=0.6;

        BGstep=3;
        BGstep=1;
        PlayMusic(GetCurrentScriptDirectory~"\bgm\bgm1.mp3");Wait(58);

        WaitForZeroEnemy();
        ForbidShot(false);
        ForbidBomb(false);

        if (GetCommonDataDefault("Go",0)<=0) {
            SetCommonData("Go",1);
        }
        if (GetPlayerType()==REIMU_A || GetPlayerType()==REIMU_B) {
            if (GetPlayerY()<162) {
                SetCommonData("Go",0);
            }
        }
        else if (GetPlayerType()==MARISA_A || GetPlayerType()==MARISA_B) {
            if (GetPlayerY()<178) {
                SetCommonData("Go",0);
            }
        }
        else {
            if (GetPlayerY()<166) {
                SetCommonData("Go",0);
            }
        }

        loop(6) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+110,480,0,0,5);
        }
        loop(2) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+110,-92,0,0,10);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+110,480,0,0,5);
        }
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+53,-136,0,0,12);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-53,-136,0,0,12);
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+110,-92,0,0,10);
        }
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-110,480,0,0,5);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+110,-92,0,0,10);
        }
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-110,480,0,0,5);
        }
        loop(2) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-110,-92,0,0,10);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-110,480,0,0,5);
        }
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-110,-92,0,0,10);
        }
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-110,-92,0,0,10);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+160,480,0,0,5);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-160,480,0,0,5);
        }
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx+160,480,0,0,5);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy13.txt",cx-160,480,0,0,5);
        }
        Wait(30);
        loop(6) {
            Wait(8);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-160,-52,0,0,10);
            Wait(8);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+160,-52,0,0,10);
        }


        Wait(20);

        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx,-160,0,0,3);

        Wait(55);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+157,-76,0,0,12);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-157,-76,0,0,12);
        Wait(15);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+157,-166,0,0,12);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-157,-166,0,0,12);
        Wait(15);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+67,-166,0,0,12);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-67,-166,0,0,12);
        Wait(20);yousei2(150,2,-60,0);
        if (GetCommonDataDefault("Go",0)>0) {
            SetCommonData("Go",0);
        }

        Wait(140);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx,-121,0,0,12+1*(GetCommonDataDefault("Mode",0)>=3));

        Wait(90);tama4(8);
        Wait(90);
        loop(8) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,220,0,0,16);
        }tama5(8);

        if (GetCommonDataDefault("Mode",0)>=2) {
            loop(5) {
                Wait(13);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx,550,0,0,9);
            }
        }else {
            Wait(80);
        }

        loop(8) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,250,0,0,16);
        }
        Wait(75);if (GetCommonDataDefault("Mode",0)>=2) {
            tama3(8,0);
        }
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+47,-136,0,0,11);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-47,-136,0,0,11);
        Wait(10);
        Wait(15);
        Wait(45);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+157,-46,0,0,11);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-157,-46,0,0,11);
        if (GetCommonDataDefault("Mode",0)>1) {
            Wait(50);
            loop(6) {
                Wait(20);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+103,-92,0,0,10);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-103,-92,0,0,10);
            }
            tama5(8);
            Wait(100);
        }
        else {
            Wait(70);
            tama5(8);
            Wait(90);
        }
        if (GetCommonDataDefault("Go",0)>0) {
            SetCommonData("Go",0);
        }
        loop(8) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,250,0,0,16);
        }tama4(8);

        if (GetCommonDataDefault("Mode",0)>=2) {
            loop(5) {
                Wait(13);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx,550,0,0,9);
            }
        }else {
            Wait(80);
        }

        loop(8) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,170,0,0,16);
        }

        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+188,65,0,0,5.5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-188,65,0,0,5.5);ame;
        Wait(60);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+53,-92,0,0,13);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-53,-92,0,0,13);
        Wait(25);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+53,-150,0,0,3);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-53,-150,0,0,3);
        Wait(25);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+127,-136,0,0,13);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-127,-136,0,0,13);
        Wait(40);Yspeed2=4;
        Wait(190);tama4(8);
        Wait(90);
        loop(2) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,220,0,0,16);
        }
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,220,0,0,16);
        }tama5(8);
        loop(3) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,220,0,0,16);
        }

        if (GetCommonDataDefault("Mode",0)>=2) {
            loop(5) {
                Wait(12);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx,550,0,0,9);
            }
        }else {
            Wait(60);
        }

        loop(2) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,150,0,0,16);
        }
        loop(6) {
            Wait(12);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,150,0,0,16);
        }


        tama3a(8,-220);Wait(60);

        loop(9) {
            Wait(8);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,180,0,0,16);
            Wait(8);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,180,0,0,16);
        }
        Wait(8);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,120,0,0,16);

        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-188,50,0,0,5.5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+188,50,0,0,5.5);
        loop(80) {
            Wait(1);
        }
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+85,50,0,0,5.5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-85,50,0,0,5.5);
        Wait(80);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx,-25,0,0,5.5);Yspeed2=3;

        if (GetCommonDataDefault("Mode",0)==3) {
            Wait(2);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+135,-92,0,0,13);
            Wait(2);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-135,-92,0,0,13);
        }
        Wait(170);

        Z=0;
        Yspeed2=6;
        if (Mode==0&&GetPlayerLife>=4) {
            Mode++;
        }
        if (GetCommonDataDefault("Mode",0)<=3) {
            Mode=0;
        }
        if (Mode<=0) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy12.txt",cx,-60,0,0,9);
        }

        loop(120) {
            BGG17+=2;
            Wait(1);
        }
        Wait(50);
        ura=0;if (GetCommonDataDefault("ii1",0)>=500) {
            ura=1;
        }
        Wait(150);

        ac=0;



        if (GetCommonDataDefault("Mode",0)<=1&&Mode<=0) {
            Mode=0;
            Wait(40);
        }


        if (Mode<=0) {
            SetCommonData("Go",1);
            BGG05=255;
            BGstep=6;
            Yspeed=4;
            Yspeed2=4;
            Wait(150);
            BGG23=0;
            //Wait(280);

            loop(2) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+55,0,0,0,0);
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-165,0,0,0,0);
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-55,0,0,0,0);
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+165,0,0,0,0);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),0,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-60,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-20,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-40,0,0,5);
            }
            Wait(15);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+55,0,0,0,0);
            Wait(8);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-165,0,0,0,0);
            Wait(8);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-55,0,0,0,0);
            Wait(8);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+165,0,0,0,0);
            if (ura==1) {
                SetCommonData("Go",0);
            }else {
                SetCommonData("Go",2);
            }
            if (GetCommonDataDefault("Go",0)==0) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+150+rand(-45,25),0,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-150+rand(-25,45),-60,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+150+rand(-45,25),-20,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-150+rand(-25,45),-40,0,0,5);
            }
            else {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),0,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-60,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-20,0,0,5);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-40,0,0,5);
            }
            if (GetCommonDataDefault("Go",0)==0) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx,-60,0,180,9);
            }
            loop(4) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+55,0,0,0,0);
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-165,0,0,0,0);
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-55,0,0,0,0);
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+165,0,0,0,0);
                if (GetCommonDataDefault("Go",0)==0) {
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+150+rand(-45,25),0,0,0,5);
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-150+rand(-25,45),-60,0,0,5);
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+150+rand(-45,25),-20,0,0,5);
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-150+rand(-25,45),-40,0,0,5);
                }
                else {
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),0,0,0,5);
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-60,0,0,5);
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-20,0,0,5);
                    Wait(15);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+rand(-155,155),-40,0,0,5);
                }
            }
            if (GetCommonDataDefault("Go",0)>0) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx,60,0,0,5);
            }
            Wait(40);
            loop(3) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+125,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-35,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+35,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-125,0,0,0,1);
            }
            if (GetCommonDataDefault("Go",0)>0) {
                if (ura==0) {
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-48,-64,0,0,0);
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+48,-64,0,0,1);
                }
                else {
                    yousei2(150,1,-80,0);
                }
            }
            loop(2) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+125,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-35,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+35,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-125,0,0,0,1);
            }
            if (GetCommonDataDefault("Go",0)>0) {
                Wait(40);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx,60,0,0,5);
            }
            loop(4) {
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+125,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-35,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx+35,0,0,0,1);
                Wait(15);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy03.txt",cx-125,0,0,0,1);
            }
            Wait(25);
            if (ura==0) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-28,-50,0,0,1);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+28,-50,0,0,0);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-115,-145,0,0,1);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+115,-145,0,0,0);
            }
            else {
                yousei2(0,1,-90,0);
                Wait(60);
                yousei2(120,1,60,20);
            }
            SetCommonData("Go",0);


            loop(100) {
                Wait(1);
                BGG08--;
            }
            ura=0;
            if (GetCommonDataDefault("ii1",0)>=1000) {
                ura=1;
            }
            if (ura==0) {
                Wait(170);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"rFraEvent.txt",-50,120,0,0,0);
                Wait(100);
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"rFraP2.txt",cx+120,98,0,0,0);
                Wait(60);
                if (Mode<=0) {
                    gu4++;
                }
                WaitForZeroEnemy();
                Yspeed2=5;
            }

            //BGstep=7;
            else {
                //gu4++;

                Wait(20);
                loop(60) {
                    Wait(1);
                    BGG07++;
                }
                //Wait(80);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx,0,0,0,6.1);
                loop(40) {
                    Wait(1);
                    BGG07++;
                }
                Wait(30);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+125,0,0,0,6);
                Wait(100);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-125,0,0,0,6);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+295,125,1.5,190,4);
                z3(295,355,190);
                Wait(140);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+28,5,0,0,6);
                Wait(30);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-28,5,0,0,6);
                Wait(70);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-140,5,0,0,6);
                Wait(85);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-90,5,0,0,6);
                Wait(65);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-30,5,0,0,6);
                Wait(35);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx-295,155,1.2,8,4);
                z3(-295,155,8);
                Wait(60);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+30,5,0,0,6);
                Wait(60);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+90,5,0,0,6);
                Wait(80);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+140,5,0,0,6);
                Wait(75);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+295,35,0.6,160,4.5);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+305,85,0.6,160,4.5);
                Wait(5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy06.txt",cx+315,135,0.6,160,4.5);
                Wait(140);
                z3(335,280,190);
                z3(-335,280,-10);
                Wait(60);
                SetCommonData("Go",0);
                Wait(125);
                PlaySE(GetCurrentScriptDirectory~"\se\warp.wav");
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiN05.txt",cx,-88,0,0,0);
                //CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiN05+.txt",cx,0,0,0,0);
                Wait(125);
                if (Mode<=0) {
                    gu4++;
                }

                while (GetCommonDataDefault("Go",0)<=0) {
                    yield;
                }gu9++;
                WaitForZeroEnemy();

            }










        }
        else {
            Wait(160);
            Mode=0;
        }


        gu9++;


















        if (ura==0) {
            Wait(20);
        }ura=0;gu4=0;

        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-30,-26,0,0,1);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-90,-26,0,0,1);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+30,-26,0,0,1);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+90,-26,0,0,1);
        //BGstep=1;

        loop(99) {
            Wait(1);
            if (BGG07>0) {
                BGG07--;
            }
        }


        Z=0;if (GetCommonDataDefault("Mode",0)>=2) {
            yousei(350,2,-80);
        }
        loop(4) {
            Wait(27);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+170*sin(Z),-22,0,0,10);
        }
        tank(280,6);onmyo;
        loop(4) {
            Wait(33);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+170*sin(Z),-22,0,0,10);
        }
        if (GetCommonDataDefault("Mode",0)>=3) {
            SetShotAutoDeleteClip(8,8,8,8);
        }
        loop(16) {
            Wait(30);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+170*sin(Z),-22,0,0,10);
        }tankl(220,5);
        loop(12) {
            Wait(25);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+220*sin(Z),-22,0,0,10);
        }
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy07.txt",cx+140,-110,0,0,0);
        loop(4) {
            Wait(25);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+220*sin(Z),-22,0,0,10);
        }
        Wait(32);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+rand(-40,-190),rand(-26,-70),0,0,9);
        loop(2) {
            Wait(32);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+rand(40,190),rand(-26,-70),0,0,9);
            Wait(32);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+rand(-40,-190),rand(-26,-70),0,0,9);
            Wait(15);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+220*sin(Z),-82,0,0,13);
        }
        if (GetCommonDataDefault("Mode",0)>=2) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+245,-92,0,0,7);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-245,-92,0,0,7);
        }
        if (GetCommonDataDefault("Mode",0)<=2) {
            SetShotAutoDeleteClip(78,78,78,78);
        }else {
            SetShotAutoDeleteClip(32,32,32,32);
        }
        loop(6) {
            Wait(32);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+rand(40,180),rand(-26,-70),0,0,9);
            Wait(32);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+rand(-40,-180),rand(-26,-70),0,0,9);
            Wait(15);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+220*sin(Z),-82,0,0,13);
        }
        Wait(80);
        if (GetCommonDataDefault("Mode",0)<=2) {
            SetShotAutoDeleteClip(32,32,32,32);
        }
        //CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy08.txt",cx,-32,0,0,2);
        loop(5) {
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+rand(240,280),50+rand(-70,70),0,0,3);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-rand(240,280),50+rand(-70,70),0,0,2);
        }
        //CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy08.txt",cx,-32,0,0,2.5);
        loop(6) {
            Wait(20);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+rand(240,280),50+rand(-70,70),0,0,3);
            Wait(20);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-rand(240,280),50+rand(-70,70),0,0,2);
        }
        Wait(120);

        if (GetPlayerLife>6) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant02.txt",cx+199,777,0,0,1);
        }
        loop(4) {
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }
        if (GetPlayerLife>6) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant02.txt",cx-199,735,0,0,2);
        }
        loop(4) {
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }
        loop(5) {
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z*2),-22,0,0,11);
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z*2),-22,0,0,11);
        }
        Wait(10);SetCommonData("Go",0);
        loop(2) {
            Wait(20);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx+rand(70,140),rand(-76,-110),0,0,5);
            Wait(50);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx+rand(-70,-140),rand(-76,-110),0,0,5);
            Wait(20);
        }
        Wait(28);
        loop(3) {
            Wait(36);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,62,0,0,12);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,102,0,0,12);
        }
        Wait(36);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,62,0,0,12);
        Wait(22);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,102,0,0,12);
        if (GetCommonDataDefault("Go",0)>=4) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx+rand(20,120),rand(-106,-140),0,0,5);
        }tank2l(270,5);
        if (GetPlayerLife>6) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant02.txt",cx-199,777,0,0,2);
        }
        Wait(60);
        loop(4) {
            Wait(36);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,132,0,0,12);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,172,0,0,12);
        }
        Wait(70);
        loop(2) {
            Wait(40);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx+rand(70,140),rand(-76,-110),0,0,5);
            Wait(50);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx+rand(-70,-140),rand(-76,-110),0,0,5);
        }
        Wait(48);
        loop(3) {
            Wait(36);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,62,0,0,12);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,102,0,0,12);
        }
        Wait(36);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,62,0,0,12);
        Wait(22);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-300,102,0,0,12);
        if (GetCommonDataDefault("Go",0)>=9) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx-rand(20,120),rand(-106,-140),0,0,5);
        }tank2(270,5);
        if (GetPlayerLife>6) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant02.txt",cx+199,777,0,0,1);
        }
        Wait(60);
        loop(3) {
            Wait(36);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,132,0,0,12);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,172,0,0,12);
        }
        Wait(36);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,132,0,0,12);
        Wait(22);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+300,172,0,0,12);
        if (GetCommonDataDefault("Go",0)>=10) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx+rand(20,120),rand(-106,-140),0,0,5);
        }
        Wait(20);
        onmyo;
        Wait(20);
        loop(3) {
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }
        loop(3) {
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }
        tank(320,4);
        loop(6) {
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(22);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }
        if (GetCommonDataDefault("Mode",0)>=2) {
            tank(320,4);
        }
        if (GetCommonDataDefault("Mode",0)>=2) {
            loop(6) {
                Wait(22);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
                Wait(22);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
            }
            loop(100) {
                Wait(1);
                BGG08+=0.5;
            }
            //if(GetCommonDataDefault("Mode",0)>=2){tank(320,4);}
            //onmyo;
            //loop(12){Wait(11);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+220*sin(Z*4),-22,0,0,11);
            //	 Wait(11);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-220*sin(Z*4),-22,0,0,11);}
            //Wait(60);
            //tank(320,4);
            loop(9) {
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+220*sin(Z*4),-22,0,0,11);
                Wait(8);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-220*sin(Z*4),-22,0,0,11);
            }
            Wait(20);
            //if(GetCommonDataDefault("Mode",0)>=2){tank(320,4);}
            loop(12) {
                Wait(6);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+220*sin(Z*4),-22,0,0,11);
                Wait(6);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-220*sin(Z*4),-22,0,0,11);
            }
            //if(GetCommonDataDefault("Mode",0)>=2){tank(320,4);}
            //loop(7){Wait(22);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            //	 Wait(22);CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);}
        }

        Wait(40);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy07.txt",cx,-110+rand(0,-20),0,0,1);
        BGstep=7;
        if (ura!=1) {
            FadeOutMusic(GetCurrentScriptDirectory~"\bgm\bgm1.mp3",8);
        }
        loop(2) {
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }
        if (GetCommonDataDefault("Mode",0)>=2) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+245,-92,0,0,7);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-245,-92,0,0,7);
        }
        loop(2) {
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }

        loop(2) {
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }
        if (GetCommonDataDefault("Mode",0)>=2) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx+265,-22,0,0,7);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy04.txt",cx-265,-22,0,0,7);
        }
        loop(7) {
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx+180*sin(Z),-22,0,0,11);
            Wait(18);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy09.txt",cx-180*sin(Z),-22,0,0,11);
        }





        DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm1.mp3");
        PlayMusic(GetCurrentScriptDirectory~"\bgm\bgm3.mp3");
        Wait(60);




        BGstep=4;
        SetViewTo(0, 0, 0);
        SetViewFrom(1200, 90, 45);

        WaitForZeroEnemy();
        SlowMove=0;

        if (GetCommonDataDefault("Go",0)!=0) {
            SetCommonData("Go",0);
        }




        loop(10) {
            Wait(1);
        }

        //CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy01.txt",cx,-86,0,0,4);
        loop(10) {
            Wait(1);
        }

        WaitForZeroEnemy();

        loop(20) {
            Wait(1);
        }




        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-125,0,0,0,0.5);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-75,0,0,0,0.5);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-25,0,0,0,0.5);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+25,0,0,0,0.5);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+75,0,0,0,0.5);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+125,0,0,0,0.5);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-150,-60,0,0,0);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-100,-60,0,0,0);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-50,-60,0,0,0);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx,-60,0,0,0);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+50,-60,0,0,0);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+100,-60,0,0,0);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+150,-60,0,0,0);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-125,-120,0,0,1);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-75,-120,0,0,1);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx-25,-120,0,0,1);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+25,-120,0,0,1);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+75,-120,0,0,1);
        Wait(5);
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy05.txt",cx+125,-120,0,0,1);
        Wait(60);






        Wait(120);
        FadeOutMusic(GetCurrentScriptDirectory~"\bgm\bgm3.mp3",3);
        Wait(120);
        gu4=1;
        Wait(120);




        if (GetCommonDataDefault("miss",0)==0) {
            if (GetCommonDataDefault("bomb",0)==0) {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"firstEvent3.txt",cx,-60,0,0,0);
                SetCommonDataEx("Spell","omake03",1);
                AddScore(100000000);
                if (col==0) {
                    SetCommonData("bomb",2);
                }
            }
            else {
                CreateEnemyFromFile(GetCurrentScriptDirectory~"firstEvent2.txt",cx,-60,0,0,0);
                SetCommonDataEx("Spell","omake02",1);
                AddScore(50000000);
            }
            if (col==0) {
                SetCommonData("miss",2);
                ura=1;
            }Wait(180);
        }


        if (GetCommonDataDefault("ii1",0)>=3000||GetScore()>=1000000000) {
            SetCommonDataEx("Spell","omake02",1);
            if (GetScore()>=1000000000) {
                SetCommonDataEx("Spell","omake03",1);
            }
            if (col==0) {
                SetCommonData("miss",2);
                ura=1;
            }
        }

        SetCommonData("Go",0);
        PlaySE(GetCurrentScriptDirectory~"\se\warp.wav");
        loop(140) {
            BGG11+=0.5;
            Wait(1);
        }
        if (ura!=1) {
            SetCommonDataEx("Spell","omake01",1);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"RemiEvent.txt",cx,112,0,0,0);
        }
        loop(60) {
            BGG11+=0.5;
            Wait(1);
        }
        PlaySE(GetCurrentScriptDirectory~"\se\warp.wav");
        loop(160) {
            BGG11+=0.5;
            Wait(1);
        }

        gu4=1;
        Wait(80);

        if (ura!=1) {
            SetCommonDataEx("Spell","omake01",1);
            if (GetCommonDataDefault("ii1",0)>=2000) {
                WaitForZeroEnemy();
                SetCommonDataEx("Spell","omake01",1);
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiP.txt",cx,112,0,0,0);
                DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm3.mp3");
                PlayMusic(GetCurrentScriptDirectory~"\bgm\bgm2.mp3");
                WaitForZeroEnemy();
                PlaySE(GetCurrentScriptDirectory~"\se\Baaaan.wav");
                Wait(80);
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiP4.txt",cx,-116,0,0,0);
                WaitForZeroEnemy();
                PlaySE(GetCurrentScriptDirectory~"\se\Baaaan.wav");
                Wait(120);
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiP2.txt",cx,0,0,0,0);
                WaitForZeroEnemy();
                PlaySE(GetCurrentScriptDirectory~"\se\bom13.wav");
                SetCommonData("flash2",255);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetCommonDataDefault("x",0),GetCommonDataDefault("y",0),0,0,4);
                Wait(20);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetCommonDataDefault("x",0)+64,GetCommonDataDefault("y",0)-22,0,0,3);
                Wait(20);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetCommonDataDefault("x",0)-64,GetCommonDataDefault("y",0)+22,0,0,3);
                Wait(120);
                FadeOutMusic(GetCurrentScriptDirectory~"\bgm\bgm2.mp3",8);
                //loop(360) {
                //    BGG11-=0.5;
                //    Wait(1);
                //}
                Wait(180);
                BGstep=5;
            }
            else {
                WaitForZeroEnemy();
                SetCommonDataEx("Spell","omake01",1);
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiP.txt",cx,112,0,0,0);
                DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm3.mp3");
                PlayMusic(GetCurrentScriptDirectory~"\bgm\bgm2.mp3");
                WaitForZeroEnemy();
                PlaySE(GetCurrentScriptDirectory~"\se\Baaaan.wav");
                Wait(80);
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiP5.txt",cx,-116,0,0,0);
                WaitForZeroEnemy();
                PlaySE(GetCurrentScriptDirectory~"\se\bom13.wav");
                SetCommonData("flash2",255);
                CollectItems;
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetCommonDataDefault("x",0),GetCommonDataDefault("y",0),0,0,4);
                Wait(20);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetCommonDataDefault("x",0)+64,GetCommonDataDefault("y",0)-22,0,0,3);
                Wait(20);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetCommonDataDefault("x",0)-64,GetCommonDataDefault("y",0)+22,0,0,3);
                Wait(120);
                FadeOutMusic(GetCurrentScriptDirectory~"\bgm\bgm2.mp3",8);
                //loop(360) {
                //    BGG11-=0.5;
                //    Wait(1);
                //}
                Wait(180);
                BGstep=5;
            }
        }

        else {
            DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm3.mp3");
            PlayMusic(GetCurrentScriptDirectory~"\bgm\bgm5.mp3");
            PlaySE(GetCurrentScriptDirectory~"\se\warp.wav");
            if (GetCommonDataDefault("Go",0)>0) {
                SetCommonData("Go",0);
            }
            SetCommonDataEx("Spell","omake02",1);
            CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiN08.txt",cx,112,0,0,0);
            loop(100) {
                BGG20++;
                BGG19++;
                yield;
            }
            SetCommonData("miss",4);
            //while(GetCommonDataDefault("Go",0)<=0){yield;}
            loop(255) {
                Wait(1);
                BGG21+=1;
                if (BGG02>-5) {
                    BGG02-=2;
                }
            }
            SetCommonData("miss",4);
            while (GetCommonDataDefault("Go",0)<=1) {
                yield;
            }
            if (GetCommonDataDefault("Go",0)==2) {
                SetCommonDataEx("Spell","omake03",1);
                Wait(2);
                FadeOutMusic(GetCurrentScriptDirectory~"\bgm\bgm5.mp3",8);
                CreateEnemyBossFromFile(GetCurrentScriptDirectory~"RemiN08a.txt",cx,138,0,0,0);
                BGG22+=1;
                SetCommonDataEx("Spell","omake03",1);
                Wait(512);
                DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm5.mp3");
                WaitForZeroEnemy();
                SetCommonData("miss",3);
                if (GetCommonDataDefault("miss",0)==3) {
                    loop(360) {
                        if (BGG19>0) {BGG19--;}
                        if (BGG20>0) {BGG20--;}
                        if (BGG21>0) {BGG21--;}
                        BGG11-=0.5;
                        Wait(1);
                    }
                } 
            }
            Wait(180);
            FadeOutMusic(GetCurrentScriptDirectory~"\bgm\bgm5.mp3",8);
        }



        //ステージクリア
        BGG06=0;

        ForbidShot(true);
        ForbidBomb(true);
        Wait(120);

        while (GetPlayerLife()>1) {
            ExtendPlayer(-1);
            AddScore(10000000);
            PlaySE(GetCurrentScriptDirectory~"\se\power33.wav");
            Wait(60);
            yield;
        }
        while (GetPlayerBomb()>0) {
            AddBomb(-1);
            AddScore(2000000);
            PlaySE(GetCurrentScriptDirectory~"\se\power32.wav");
            Wait(40);
            yield;
        }
        Wait(100);
        if (replay<=0) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"LastEvent.txt",0,0,0,0,0);
        }
        WaitForZeroEnemy();
        Wait(120);

        PlayMusic(GetCurrentScriptDirectory~"\bgm\bgm3.mp3");
        Wait(120);

        if (GetCommonDataDefault("miss",0)<=2) {
            loop(255) {
                BGG15++;
                yield;
            }
            BGG13=255;
            Wait(60);
            loop(255) {
                BGG15--;
                BGG12++;
                yield;
            }
            Wait(60);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"LastEvent2.txt",0,0,0,0,0);
            Wait(304);
            loop(255) {
                BGG15++;
                BGG12--;
                yield;
            }
        }

        else {
            loop(255) {
                BGG15++;
                yield;
            }
            BGG13=255;
            Wait(60);
            loop(255) {
                BGG15--;
                BGG12++;
                yield;
            }
            Wait(60);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"LastEvent2.txt",0,0,0,0,0);
            Wait(304);
            loop(255) {
                BGG15++;
                BGG12--;
                yield;
            }
        }

        Wait(255);
        WaitForZeroEnemy();
        Wait(300);
        Clear();


        Wait(64);

    }

    @MainLoop()
    {
        if (GetPoint>=xUP) {
            PlaySE(GetCurrentScriptDirectory~"\se\power33.wav");
            ExtendPlayer(1);
            xUP+=xUP;
        }

        if (xUP<=4000) {
            SetNormPoint(xUP);
        }

        if (BGG06==1) {
            if (GetKeyState(VK_SHOT)==KEY_PUSH||GetKeyState(VK_SHOT)==KEY_HOLD) {
                ForbidShot(false);
            }
            else {
                ForbidShot(true);
            }
        }

        if (GetScore>=xBOMB) {
            PlaySE(GetCurrentScriptDirectory~"\se\power32.wav");
            AddBomb(1);
            xBOMB+=200000000;
        }


        if (!OnPlayerMissed) {
            if (GetKeyState(VK_SLOWMOVE)==KEY_HOLD) {
                if (ma<250) {
                    ma+=10;
                }
            }else {
                if (ma>0) {
                    ma-=10;
                }
            }
        }
        if (OnPlayerMissed) {
            if (ma>0) {
                ma-=10;
            }
        }

        if (gra3-GetGraze()<0) {
            gra++;
            gra2=18;
        }gra3=GetGraze();
        if (gra>16) {
            gra=16;
        }if (gra>0&&gra2<0) {
            gra--;
            gra2=18;
        }gra2--;
        if (GetCommonDataDefault("ddffffffffrrr",0)>=0&&gra>10&&count%8==0&&ze==0) {
            CollectItems;
        }

        if (count<110) {
            gra=16;
        }if (count==110) {
            gra=0;
        }if (OnBomb==true) {
            gra=12;
        }

        if (gra<11) {
            if (GetPlayerType()==REIMU_A || GetPlayerType()==REIMU_B) {
                if (GetPlayerY()<162) {
                    gra=11;
                }
            }
            else if (GetPlayerType()==MARISA_A || GetPlayerType()==MARISA_B) {
                if (GetPlayerY()<178) {
                    gra=11;
                }
            }
            else {
                if (GetPlayerY()<166) {
                    gra=11;
                }
            }
        }

        if (BGstep==1) {
            if (BGG00<225) {
                BGG00+=1;
            }if (BGG01>0) {
                BGG01-=3;
            }if (BGG04>0) {
                BGG04-=1;
            }if (BGG05>0) {
                BGG05-=1;
            }
        }
        if (BGstep==3) {
            if (BGG01<255) {
                BGG01+=2;
            }
        }
        if (BGstep==4) {
            if (BGG00>0) {
                BGG00-=2;
            }if (BGG01>0) {
                BGG01-=3;
            }if (BGG03>0) {
                BGG03-=1;
            }if (BGG02<255) {
                BGG02+=1;
            }if (BGG04>0) {
                BGG04-=1;
            }if (BGG05>0) {
                BGG05-=1;
            }
        }
        if (BGstep==6) {
            if (BGG00>0) {
                BGG00-=1;
            }if (BGG01>0) {
                BGG01-=3;
            }if (BGG03<255) {
                BGG03+=1;
            }if (BGG04<255) {
                BGG04+=1;
            }if (BGG05<255) {
                BGG05+=1;
            }
        }
        if (BGstep==7||BGstep==8) {
            if (BGG00>0) {
                BGG00-=1;
            }
            if (BGG05>0) {
                BGG05-=1;
            }
            if (BGG01>0) {
                BGG01-=3;
            }if (BGG03<255) {
                BGG03+=1;
            }if (BGG02>0) {
                BGG02-=1;
            }if (BGG04>0) {
                BGG04-=5;
            }if (BGG04<0) {
                BGG04=0;
            }
        }
        if (BGstep==9) {
            if (BGG00>0) {
                BGG00-=2;
            }if (BGG01>0) {
                BGG01-=3;
            }if (BGG03>0) {
                BGG03-=1;
            }if (BGG04>0) {
                BGG04-=1;
            }if (BGG05>0) {
                BGG05-=1;
            }
        }

        if (OnEnemySpell==true) {
            if (BG>2) {
                BG-=2;
            }SetCommonData("Black",0);
        }else {
            BG=100;
        }

        if (GetEnemyLife<=0) {
            BG=100;
        }

        if (Dark<GetCommonDataDefault("Black",0)&&BGG00<=0) {
            Dark++;
        }
        if (Dark>GetCommonDataDefault("Black",0)&&BGG00<=0) {
            Dark-=5;
        }


        if (GetCommonDataDefault("flash2",0)>0) {
            SetCommonData("flash2",GetCommonDataDefault("flash2",0)-3);
        }





        if (gu4<=0) {

            if (gu2>=20&&gra<5&&count%3<=1) {
                gu2--;
            }

            if (gu2>0&&gu2<20&&gra<5&&count%3<=0) {
                gu2--;
            }

            if (OnPlayerMissed==true&&gu2>0&&gra>=5&&count%3<=1) {
                gu2--;
            }

            if (gu2==0&&count%3<=2&&gu1>0&&gu1>GetCommonDataDefault("ii1",0)) {
                gu1-=3;
            }

            if (gu1>0&&gu1>GetCommonDataDefault("ii1",0)) {
                gu1-=1;
            }

            if (gu1<0) {
                gu1=0;
            }

            if (gu2==0&&GetCommonDataDefault("ii1",0)>0&&count%3<=2&&GetCommonDataDefault("ii3",0)<=0) {
                SetCommonData("ii1",GetCommonDataDefault("ii1",0)-3);
            }

            if (GetCommonDataDefault("ii1",0)>0&&count%3<=2&&OnPlayerMissed==true) {
                SetCommonData("ii1",GetCommonDataDefault("ii1",0)-1);
            }

            if (GetCommonDataDefault("ii1",0)<0) {
                SetCommonData("ii1",0);
            }

            if (GetCommonDataDefault("ii3",0)>0) {
                SetCommonData("ii3",GetCommonDataDefault("ii3",0)-1);
                gu2+=20;
            }

            if (gu2>60) {
                gu2=60;
            }

            //if(OnBomb==true){SetCommonData("ii2",3);}
            //else{
            SetCommonData("ii2",1);
            if (gu2>=60) {
                SetCommonData("ii2",5);
            }
            else if (gu2>50) {
                SetCommonData("ii2",3);
            }
            else if (gu2>40) {
                SetCommonData("ii2",2);
            }//}

            gu7=0;
            gu9=0;
            if (gu8>0) {
                gu8-=2;
            }

        }

        else {

            gu7++;
            //if(gu7>220&&gu8<120&&gu9<=0){gu8+=2;}
            //if(gu8>0&&gu9>0){gu8-=2;}

        }

        if (GetCommonDataDefault("ii1",0)>gu1&&count%(3-2*(gu4>0))==0) {
            gu1++;//表示が増える
            if (OnBomb==true) {
                gu3=0.1;
            }else if (gu2>=60) {
                gu3=3.2;
            }else {
                gu3=0.1;
            }

            if (GetScore()<1800000000) {
                if (gu2>0) {
                    AddScore(int(GetCommonDataDefault("ii1",0)*gu3*64))
                }
                else {
                    AddScore(int(GetCommonDataDefault("ii1",0)*5))
                }
            }

            else {
                if (gu2>0) {
                    AddScore(int(GetCommonDataDefault("ii1",0)*gu3))
                }
                else {
                    AddScore(int(GetCommonDataDefault("ii1",0)*0.1))
                }
            }
        }

        if (gu1>=1000&&gu1<2000&&gu10<12) {
            gu10+=2;
        }
        if (gu1>=2000&&gu10<18) {
            gu10+=2;
        }
        if (gu1>=1000&&gu1<2000&&gu10>12) {
            gu10-=2;
        }
        if (gu1<1000&&gu10>0) {
            gu10-=2;
        }

        ac+=Yspeed;

        if (uprrS==0) {
            if (GetPlayerLife()>=8&&uprr<9) {
                uprr3++;
            }
            if (GetPlayerLife()>=8&&uprr3>60) {
                uprr++;
                uprr3=0;
                ExtendPlayer(-1);
                PlaySE(GetCurrentScriptDirectory~"\se\power34.wav");
            }
            if (GetPlayerLife()<7&&uprr>0) {
                uprr--;
                ExtendPlayer(1);
            }
            if (uprr2<=0&&uprr>0) {
                uprr2++;
                itemg;
                itemg2;
            }
            if (uprr2>0&&uprr<=0) {
                uprr2--;
            }
            if (uprr>8) {
                uprr=0;
                uprrS=1;
            }
        }

        if (borrS==0) {
            if (GetPlayerBomb()>=7&&borr<9) {
                borr3++;
            }
            if (GetPlayerBomb()>=7&&borr3>60) {
                borr++;
                borr3=0;
                AddBomb(-1);
                PlaySE(GetCurrentScriptDirectory~"\se\power34.wav");
            }
            if (GetPlayerBomb()<6&&borr>0) {
                borr--;
                AddBomb(1);
            }
            if (borr2<=0&&borr>0) {
                borr2++;
                bombg;
                bombg2;
            }
            if (borr2>0&&borr<=0) {
                borr2--;
            }
            if (borr>8) {
                borr=0;
                borrS=1;
            }
        }



        //この辺でハイスコア判定


        if (GetScore()>GetCommonDataDefaultEx("Spell","HighScore",0)&&count%2==0) {
            SetCommonDataEx("Spell","HighScore",GetScore());
        }

        if (OnPlayerMissed==true&&GetCommonDataDefault("miss",0)==0) {
            SetCommonData("miss",1);
        }

        if (OnBomb==true&&GetCommonDataDefault("bomb",0)==0) {
            SetCommonData("bomb",1);
        }


        if (Yspeed2>Yspeed) {
            Yspeed+=0.01;
        }if (Yspeed2<Yspeed) {
            Yspeed-=0.01;
        }
        count++;
        Z++;
        ZZ++;
        yield;
    }

    @DrawTopObject() {

        SetGraphicAngle(0, 0, 0);
        if (GetCommonDataDefault("last",false)==false) {
            if (OnBomb==true||OnEnemySpell==true||IsBGStopping==true) {
                Slow(0);
            }
        }

        SetTexture(GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        SetGraphicScale(1,1);
        SetAlpha(mo2);
        SetColor(255,255,255);
        if (GetPlayerX()<200&&GetPlayerY()<265) {
            if (mo2>50) {
                mo2-=8;
            }
        }
        if (GetPlayerX()>=200||GetPlayerY()>=265) {
            if (mo2<255) {
                mo2+=4;
            }
        }
        SetRenderState(ALPHA);

        SetGraphicScale(1,1);
        SetRenderState(ALPHA);
        SetColor(255,0,0);
        ascent(let t in 0..10) {
            if (gu1%10==t) {
                SetGraphicRect(164+24*t,33+192*(gu4>0),183+24*t,69+192*(gu4>0));
            }
        }
        DrawGraphic(113-gu8*(1+0.5*(gu1>=2000))+gu10,100);
        ascent(let t in 0..10) {
            if (gu1%100>=t*10&&gu1%100<(t+1)*10) {
                SetGraphicRect(164+24*t,33+192*(gu4>0),183+24*t,69+192*(gu4>0));
            }
        }
        DrawGraphic(93-gu8*(1+0.5*(gu1>=2000))+gu10,100);
        ascent(let t in 0..10) {
            if (gu1%1000>=t*100&&gu1%1000<(t+1)*100) {
                SetGraphicRect(164+24*t,33+192*(gu4>0),183+24*t,69+192*(gu4>0));
            }
        }
        DrawGraphic(73-gu8*(1+0.5*(gu1>=2000))+gu10,100);
        if (gu1>=1000) {
            ascent(let t in 0..10) {
                if (gu1%10000>=t*1000&&gu1%10000<(t+1)*1000) {
                    SetGraphicRect(164+24*t,33+192*(gu4>0),183+24*t,69+192*(gu4>0));
                }
            }
            DrawGraphic(53-gu8*(1+0.5*(gu1>=2000))+gu10,100);
        }



        if (gu4<=0) {
            //SetColor(255,0+255*(gu4==0&&gu2>=60&&count%4<=0),0+255*(gu4==0&&gu2>=60&&count%4<=0));
            SetGraphicRect(408,42+192*(gu4>0)+143*(gu4==0&&gu2>=60&&count%4<=0),470,72+192*(gu4>0)+143*(gu4==0&&gu2>=60&&count%4<=0));
            SetGraphicScale(0.5,0.5);
            DrawGraphic(118-gu8,130);
        }

        if (gu4>0) {
            SetGraphicRect(176,272,224,304);
            SetGraphicScale(1,1);
            if (gu9<=0||count%4<=1) {
                DrawGraphic(100-gu8*1.5,130);
            }
        }

        SetGraphicRect(96,0,128,96);
        SetGraphicScale(1,1);
        SetAlpha(mo2);
        SetColor(255,255,255);
        if (GetPlayerX()<200&&GetPlayerY()<265) {
            if (mo2>50) {
                mo2-=8;
            }
        }
        if (GetPlayerX()>=200||GetPlayerY()>=265) {
            if (mo2<255) {
                mo2+=4;
            }
        }
        SetRenderState(ALPHA);
        DrawGraphic(48,100);


        if (GetCommonDataDefault("ddffffffffrrr",0)>=0) {
            if (gra<=10) {
                SetGraphicRect(0,32*gra,64,32+32*gra);
            }
            if (gra<=0) {
                SetGraphicRect(0,0,64,32);
            }
            if (gra>10&&count%8>=0) {
                SetGraphicRect(0,352,64,384);
            }
            if (gra>10&&count%8>=4) {
                SetGraphicRect(0,384,64,416);
            }
            SetGraphicScale(1,1);
            SetAlpha(255);
            SetColor(mo,mo,mo);
            if (GetPlayerX()<160&&GetPlayerY()>332) {
                if (mo>50) {
                    mo-=4;
                }
            }
            if (GetPlayerX()>=160||GetPlayerY()<=332) {
                if (mo<255) {
                    mo+=4;
                }
            }
            SetRenderState(ADD);
            DrawGraphic(74,440);
        }

        SetTexture(GetCurrentScriptDirectory~"shot_all.png");
        SetGraphicRect(0, 290, 28, 317);
        SetGraphicScale(0.42,0.4);
        SetAlpha(255);
        SetColor(255,255,255);
        if (ma<255) {
            SetAlpha(ma);
        }
        SetRenderState(ALPHA);
        DrawGraphic(GetPlayerX+1,GetPlayerY+0.5);

        if (BGG01>0) {
            SetTexture(GetCurrentScriptDirectory~"\img\Title2.png");
            SetGraphicRect(0,0,512,512);
            SetGraphicScale(1,1);
            SetAlpha(255);
            SetColor(255,255,255);
            if (BGG01<255) {
                SetAlpha(BGG01);
            }
            SetRenderState(ALPHA);
            DrawGraphic(cx,cy);
        }

        if (count<=110) {
            SetTexture(GetCurrentScriptDirectory~"\img\getitemborder.png");
            if (count%8>=0) {
                SetGraphicRect(0,0,512,64);
            }
            if (count%8>=4) {
                SetGraphicRect(0,64,512,128);
            }
            SetGraphicAngle(0,0,0);
            SetGraphicScale(1,1);
            SetAlpha(255);
            SetColor(255,255,255);
            if (count>=80) {
                SetColor(255-(count-80)*8,255-(count-80)*8,255-(count-80)*8);
            }
            if (count<=30) {
                SetColor(count*8,count*8,count*8);
            }
            SetRenderState(ADD);
            if (GetPlayerType()==REIMU_A || GetPlayerType()==REIMU_B) {
                DrawGraphic(cx+5,162);
            }
            else if (GetPlayerType()==MARISA_A || GetPlayerType()==MARISA_B) {
                DrawGraphic(cx+5,178);
            }
            else {
                DrawGraphic(cx+5,166);
            }
        }

        if (GetCommonDataDefault("flash2",0)>0) {
            SetTexture(GetCurrentScriptDirectory~"\img\3a.png");
            SetGraphicRect(0,0,384,448);
            SetRenderState(ADD);
            SetGraphicScale(GetCommonDataDefault("flash2",0)/255,1);
            SetGraphicAngle(0,0,0);
            SetColor(GetCommonDataDefault("flash2",0),0,0);
            SetAlpha(255);
            DrawGraphic(GetCenterX(),GetCenterY());
        }

        if (BGG16>0) {//メニュ
            SetTexture(GetCurrentScriptDirectory~"\img\st00.png");
            SetGraphicRect(0,0,384,448);
            SetRenderState(ALPHA);
            SetGraphicScale(1,1);
            SetGraphicAngle(0,0,0);
            SetColor(255,255,255);
            SetAlpha(BGG16);
            DrawGraphic(GetCenterX(),GetCenterY());
            SetTexture(GetCurrentScriptDirectory~"\img\moji.png");
            //SetGraphicRect(1392,736,1536,896);
            SetGraphicRect(0,0,512,512);
            DrawGraphic(GetCenterX()+4,GetCenterY()-100);
            if (Z11>0) {
                SetAlpha(130-125*sin(count*3+90)*(Z11/255));
                SetColor(Z11,Z11,Z11);
                SetGraphicRect(1360,928,1568,975);
                DrawGraphic(GetCenterX()-2,GetCenterY()+135);
            }
        }

	if(gu5>0){
		SetTexture(GetCurrentScriptDirectory~"\img\moji.png");
		SetGraphicRect(512,0,1024,64);
		SetRenderState(ADD);
		SetGraphicScale(1,1);
		SetGraphicAngle(0,0,0);
		SetColor(0,0,gu5/2+gu5/2*sin(count*3+90));
		SetAlpha(255);
		if(gu5<255){
		    SetColor(0,0,gu5);
		}
		if(gu5<255&&count%8<=3){
		    SetColor(0,0,0);
		}
		DrawGraphic(GetCenterX()+11,GetCenterY()+130);
	}

	if(gu6>0){
		SetTexture(GetCurrentScriptDirectory~"\img\moji.png");
		SetGraphicRect(512,64,1024,128);
		SetRenderState(ADD);
		SetGraphicScale(1,1);
		SetGraphicAngle(0,0,0);
		SetColor(0,0,gu6/2+gu6/2*sin(count*3+90));
		SetAlpha(255);
		if(gu6<255){
		    SetColor(0,0,gu6);
		}
		if(gu6<255&&count%8<=3){
		    SetColor(0,0,0);
		}
		DrawGraphic(GetCenterX()+11,GetCenterY()+132);
	}

        if (BGG13>0||BGG15>0) {//おしまい
            SetTexture(GetCurrentScriptDirectory~"\img\last.png");
            if (GetCommonDataDefault("miss",0)==4) {
                SetTexture(GetCurrentScriptDirectory~"\img\last2.png");
            }
            SetGraphicScale(0.45,0.45);
            SetGraphicRect(0,0,1024,1540);
            SetAlpha(BGG13);
            SetColor(BGG12*0.9,BGG12*0.9,BGG12*0.9);
            SetRenderState(ALPHA);
            if (ura==0) {
                SetGraphicScale(0.5,0.5);
                SetGraphicRect(0,0,1000,1000);
                SetColor(BGG12*0.9,BGG12*0.9,BGG12*0.9);
                SetTexture(GetCurrentScriptDirectory~"\img\shadow2.png");
                if (GetCommonDataDefault("ii1",0)>=2000) {
                    SetTexture(GetCurrentScriptDirectory~"\img\shadow.png");
                }
                DrawGraphic(cx,cy);
                SetAlpha(BGG15);
                DrawGraphic(cx,cy);
            }
            else {
                DrawGraphic(cx-1,cy);
                SetGraphicRect(1024,0,2048,1540);
                SetAlpha(BGG15);
                DrawGraphic(cx-2,cy);
            }
        }


    }

    @DrawBottomObject() {

        if (count<=1) {//処理落ち
            SetTexture(GetCurrentScriptDirectory~"\img\st08.png");
            SetAlpha(255);
            SetRenderState(ALPHA);
            SetColor(255,255,255);
            SetGraphicScale(1,1);
            SetGraphicAngle(0, 0, 0);
            SetGraphicRect(count*3,count*3,384+count*3,488+count*3);
            DrawGraphic(cx,cy);
            SetTexture(GetCurrentScriptDirectory~"\img\NuclearRing5.png");
            SetRenderState(ADD);
            DrawGraphic(cx,cy);
        }

        if (BGG03>0) {//ベース・黒
            SetTexture(GetCurrentScriptDirectory~"\img\st00.png");
            SetGraphicRect(0,0,384,448);
            SetRenderState(ALPHA);
            SetGraphicScale(1,1);
            SetGraphicAngle(0,0,0);
            SetColor(255,255,255);
            SetAlpha(BGG03);
            DrawGraphic(GetCenterX(),GetCenterY());
        }

        if (BGG23>0) {
            SetTexture(GetCurrentScriptDirectory~"\img\st02.png");
            SetGraphicRect(0,0,384,1464);
            SetGraphicScale(1,1);
            SetAlpha(255);
            SetColor(BGG00,BGG00,BGG00);
            SetRenderState(ADD);
            DrawGraphic(cx,cy-ac%488);
            SetTexture(GetCurrentScriptDirectory~"\img\st01.png");
            SetGraphicScale(1,1);
            SetGraphicRect(0,0,384,1464);
            SetAlpha(255);
            SetColor(BGG00,BGG00,BGG00);
            SetRenderState(SUBTRACT);
            DrawGraphic(cx,cy+ac%488);
            if (BGG18>0) {
                SetTexture(GetCurrentScriptDirectory~"\img\NuclearRing5.png");
                SetGraphicScale(0.7,0.7);
                SetGraphicRect(0+count*5,0-count*12,512+count*5,768-count*18);
                SetAlpha(255);
                SetColor(BGG18*0.1,BGG18*0.1,BGG18*0.3);
                SetRenderState(ADD);
                DrawGraphic(cx,cy);
            }
            if (BGG17>0) {
                SetTexture(GetCurrentScriptDirectory~"\img\NuclearRing5.png");
                SetGraphicScale(0.4,0.4);
                SetGraphicRect(0+count*4,0-count*10,1028+count*4,1156-count*10);
                SetAlpha(255);
                SetColor(BGG17*0.1,BGG17*0.2,BGG17*0.4);
                SetRenderState(ADD);
                DrawGraphic(cx,cy);
            }
        }

        if (BGG04>0) {//中盤背景
            SetTexture(GetCurrentScriptDirectory~"\img\st04.png");
            SetGraphicRect(0,0+ac,384,448*6+ac);
            SetGraphicScale(1,1);
            SetAlpha(255);
            SetRenderState(ADD);
            if ((|BGG08|)<100) {
                color=BGG04*((BG/145)+0.28)*((100-(|BGG08|))/100)*((100-BGG07)/100);
                SetColor(color,color,color);
                DrawGraphic(cx,cy);
            }
            if (BGG08<0) {//赤
                SetTexture(GetCurrentScriptDirectory~"\img\st04a.png");
                color=BGG04*((BG/145)+0.28)*(-BGG08/100)*((100-BGG07)/100);
                SetColor(color,color,color);
                DrawGraphic(cx,cy);
            }
            if (BGG08>0) {//虹
                SetTexture(GetCurrentScriptDirectory~"\img\st04.png");
                color=BGG04*((BG/145)+0.28)*(BGG08/100)*((100-BGG07)/100);
                SetColor(color,color,color);
                DrawGraphic(cx,cy);
            }
            if (BGG07>0) {//灰
                SetTexture(GetCurrentScriptDirectory~"\img\st04b.png");
                color=255*(BGG07/100);
                SetColor(color,color,color);
                DrawGraphic(cx,cy);
            }
        }

        if (BGG02>0) {//レミリア・背景
            SetTexture(GetCurrentScriptDirectory~"\img\st00.png");//闇
            SetGraphicRect(0,0,384,448);
            SetGraphicScale(1+0.1*(BGG11/180),1+0.2*(BGG11/180));
            SetGraphicAngle(0,0,0);
            SetColor(255,255,255);
            SetAlpha(255*(BGG11/180)*(BG/100));
            //SetAlpha(BGG03*0.7*(BG/100)*(BGG11/180));
            SetRenderState(ALPHA);
            DrawGraphic(GetCenterX(),GetCenterY());
            SetGraphicScale(1.1+0.1*(BGG11/180),1.1+0.2*(BGG11/180));
            DrawGraphic(GetCenterX(),GetCenterY());

            SetTexture(GetCurrentScriptDirectory~"\img\moon3-3.png");//闇
            color=1.3+0.1*sin(Z*2)+0.2*(BGG11/180);
            SetGraphicScale(color,color);
            SetGraphicRect(0,0,384,488);
            SetAlpha(255);
            color=BGG02*(BG/100);
            SetColor(color,color,color);
            SetRenderState(SUBTRACT);
            DrawGraphic(cx,cy-5+22*(BGG11/180));
            color=1.4+0.1*sin(Z*2)+0.2*(BGG11/180);
            SetGraphicScale(color,color);
            DrawGraphic(cx,cy-11+22*(BGG11/180));

            SetTexture(GetCurrentScriptDirectory~"\img\moon3-2.png");//雲
            SetGraphicScale(1,1);
            SetGraphicRect(-Z,512,1028-Z,768);
            SetAlpha(255);
            color=BGG02*(BG/100)*((BGG11)/180);
            SetColor(0.7*color,0,0.05*color);
            SetRenderState(ADD);
            DrawGraphic(cx,cy+83);
            SetGraphicScale(1,1);
            SetGraphicRect(Z,512,-1028+Z,768);
            SetAlpha(255);
            SetRenderState(ADD);
            DrawGraphic(cx,cy+23);
            color=0.88-0.05*sin(Z*0.5);
            SetGraphicScale(color,color);
            SetGraphicRect(0,0,-512,-512);
            SetAlpha(255);
            color=BGG02*0.15*(BG/100);
            SetColor(color,color,color);
            SetRenderState(ADD);
            //DrawGraphic(cx,cy+215);
        }

        if (BGG05>0) {//フラン・黒
            SetTexture(GetCurrentScriptDirectory~"\img\st05.png");
            SetGraphicScale(1.7,1.7);
            SetAlpha(255);
            SetColor(BGG05,BGG05,BGG05);
            SetGraphicRect(0,0,384,448);
            SetRenderState(SUBTRACT);
            DrawGraphic(cx+100*cos(count/4),cy+100*sin(count/3));
        }

        if (Dark>0) {//レミリア通常・黒
            SetTexture(GetCurrentScriptDirectory~"\img\st00.png");
            SetGraphicRect(0,0,384,448);
            SetRenderState(ALPHA);
            SetGraphicScale(1,1);
            SetGraphicAngle(0,0,0);
            SetColor(255,255,255);
            SetAlpha(Dark+8);
            DrawGraphic(GetCenterX(),GetCenterY());
        }

        if (BGG02>0) {//レミリア・背景
            if (BGG11>0) {
                SetTexture(GetCurrentScriptDirectory~"\img\moon3-2.png");//赤い月
                SetGraphicScale(0.4+0.2*((BGG11)/180),0.4+0.2*((BGG11)/180));
                SetGraphicRect(0,0,512,512);
                SetGraphicAngle(0,0,0);
                SetAlpha(255);
                color=BGG02*0.5*(BG/100)*(BGG11/180)*((100-BGG19)/100);
                SetColor(color,color,color);
                SetRenderState(ADD);
                DrawGraphic(cx,cy-122-3*((180-BGG11)/180));
                if (BGG09>0) {
                    SetAlpha(2*BGG09*(BGG09<=250)+255*(BGG09>250));
                    SetGraphicAngle(0,0,0);
                    SetGraphicScale(0.4+0.2*((BGG11)/180),0.4+0.2*((BGG11)/180));
                    DrawGraphic(cx,cy-122-3*((180-BGG11)/180));
                }
                SetGraphicRect(512,0,1028,512);
                SetGraphicAngle(0,0,0);
                SetGraphicScale(0.82+0.05*sin(Z*0.5),0.82+0.05*sin(Z*0.5));
                SetColor(BGG02*0.3*(BG/100)*(BGG11/180),BGG02*0.3*(BG/100)*(BGG11/180),BGG02*0.3*(BG/100)*(BGG11/180));
                DrawGraphic(cx,cy-122);
            }
            SetTexture(GetCurrentScriptDirectory~"\img\moon3-21.png");//黄色月
            SetGraphicScale(0.3+0.2*((BGG11)/180),0.3+0.2*((BGG11)/180));
            SetGraphicRect(0,0,512,512);
            SetAlpha(255);
            color=BGG02*0.5*(BG/100)*((180-BGG11)/180);
            SetColor(color,color,color);
            SetRenderState(ADD);
            DrawGraphic(cx,cy-122-3*((180-BGG11)/180));
            if (BGG11>0&&BG>6) {
                SetTexture(GetCurrentScriptDirectory~"\img\NuclearRing5.png");
                SetGraphicScale(0.7,0.7);
                SetGraphicRect(0+count*5,0-count*16,512+count*5,768-count*16);
                SetAlpha(255);
                SetColor(BGG02*0.3*(BG/100)*((BGG11)/180),0,0);
                SetRenderState(ADD);
                DrawGraphic(cx,cy);
            }
            if (BGG11<175&&BG>6) {
                SetTexture(GetCurrentScriptDirectory~"\img\NuclearRing5.png");
                SetRenderState(ADD);
                SetGraphicScale(0.7,0.7);
                SetGraphicRect(count*5,0-count*16,512+count*5,768-count*16);
                SetAlpha(255);
                color=BGG02*0.2*(BG/100)*((180-BGG11)/180);
                SetColor(color,color,color);
                DrawGraphic(cx,cy);
                SetGraphicScale(0.4,0.4);
                SetGraphicRect(count*4,0-count*10,1028+count*4,1156-count*10);
                SetAlpha(255);
                SetColor(color,color,color);
                DrawGraphic(cx,cy);
            }
        }

        if (BGG21>0) {//ラスト
            SetTexture(GetCurrentScriptDirectory~"\img\rBG05.png");
            color=(BGG21-(BGG21/2)*(count%2<=0))*0.5;
            SetColor(color,0,color);
            if (BGG22>0) {
                SetTexture(GetCurrentScriptDirectory~"\img\rBG05a.png");
                color=BGG21-(BGG21/2)*(count%2<=0);
                SetColor(color,0,color);
            }
            SetGraphicAngle(0, 0, 0);
            SetGraphicScale(0.5,0.5);
            SetAlpha(BGG21);
            SetRenderState(ALPHA);
            SetGraphicRect(0+5000*sin(count*0.3),-count*12,768+5000*sin(count*0.3),976-count*12);
            DrawGraphic(cx,cy);
            SetGraphicRect(0+5000*sin(count*0.2),count*11,768+5000*sin(count*0.2),976+count*11);
            SetAlpha(BGG21/2);
            DrawGraphic(cx,cy);
        }

    }

    @Initialize()
    {	//CreateDebugWindow();
        if (IsCommonDataAreaExists("Spell")==false) {
            CreateCommonDataArea("Spell");
        }
        LoadCommonDataEx("Spell",pass);
        SetCommonDataEx("Spell","HighScore",0);
        LoadSE(GetCurrentScriptDirectory~"\se\Shot00.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Shot01.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Shot02.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Shot03.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Shot04.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Shot05.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Shot06.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Shot07.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Laser.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Laser2.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Laser3.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Laser5.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\puu81.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\puu811.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Baaaaaaaan.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Baaaaaaaan2.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Baaaan.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\Baaaan2.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\mizu08.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\metal.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\metal37_b.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\powerdown.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\crash16_c.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\bom13.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\beam.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\warp.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\warp_2.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\warp_22.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\se002-0023.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\power32.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\power33.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\power34.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\eco00.wav");
        LoadSE(GetCurrentScriptDirectory~"\se\bom27_b.wav");
        LoadGraphic(GetCurrentScriptDirectory~"shot_all.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\3a.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\ba1.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\ba2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\ba3.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\ba4.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\circle_l.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\cloud.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\dot_flandre.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\dot_remilia.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\dot_sakuya.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\dot-kaze-ti.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\dot-Other.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\ho.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\familiar.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\getitemborder.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\JUUJI.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\kyozou.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\laserbit.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\last.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\last2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\moji.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\moon3-1.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\moon3-2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\moon3-3.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\moon3-21.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\NuclearRing.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\NuclearRing2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\NuclearRing4.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\NuclearRing5.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\NuclearSpark2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\NuclearWave2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\rBG05.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\rBG05a.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\remilia2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\shadow.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\shadow2.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st00.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st01.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st02.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st04.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st04a.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st04b.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st05.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\st07.png");
        LoadGraphic(GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        if (GetCommonDataDefaultEx("Spell","omake01",0)==0) {
            SetCommonDataEx("Spell","omake01",0);
        }
        if (GetCommonDataDefaultEx("Spell","omake02",0)==0) {
            SetCommonDataEx("Spell","omake02",0);
        }
        if (GetCommonDataDefaultEx("Spell","omake03",0)==0) {
            SetCommonDataEx("Spell","omake03",0);
        }
        SetCommonData("ii1",0);
        SetCommonData("ii2",0);
        SetCommonData("ii3",0);
        SetCommonData("x",0);
        SetCommonData("y",0);
        SetCommonData("fs",0);
        SetCommonData("ddffffffffrrr",0);
        SetCommonData("last",false);
        SetCommonData("flash",0);
        SetCommonData("flash2",0);
        SetCommonData("Black",0);
        SetCommonData("Zatsuyou",0);
        SetCommonData("Zatsuyou2",0);
        SetCommonData("Go",0);
        SetCommonData("Mode",0);
        SetCommonData("P01",0);
        SetCommonData("P02",0);
        SetCommonData("P03",0);
        SetCommonData("P04",0);
        SetCommonData("P05",0);
        SetCommonData("bgh",0);
        SetCommonData("miss",0);
        SetCommonData("bomb",0);
        ExpertEx(false,99,3);
        SetRateScoreSystemEnable(false);
        SetShotAutoDeleteClip(32,32,32,32);
        //SetDefaultStatusVisible(false);
        ForbidShot(true);
        ForbidBomb(true);
        StageTask();
    }

    @Finalize()
    {
        Slow(0);
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot00.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot01.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot02.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot03.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot04.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot05.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot06.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Shot07.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Laser.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Laser2.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Laser3.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Laser5.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\puu81.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\puu811.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Baaaaaaaan.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Baaaan.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\Baaaan2.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\mizu08.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\metal.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\metal37_b.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\powerdown.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\crash16_c.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\bom13.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\beam.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\warp.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\warp_2.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\warp_22.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\se002-0023.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\power32.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\power33.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\power34.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\eco00.wav");
        DeleteSE(GetCurrentScriptDirectory~"\se\bom27_b.wav");
        DeleteGraphic(GetCurrentScriptDirectory~"shot_all.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\3a.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\ba1.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\ba2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\ba3.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\ba4.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\circle_l.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\cloud.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\dot_flandre.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\dot_remilia.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\dot_sakuya.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\dot-kaze-ti.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\dot-Other.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\ho.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\familiar.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\getitemborder.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\JUUJI.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\kyozou.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\laserbit.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\last.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\last2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\moji.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\moon3-1.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\moon3-2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\moon3-3.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\moon3-21.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\NuclearRing.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\NuclearRing2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\NuclearRing4.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\NuclearRing5.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\NuclearSpark2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\NuclearWave2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\rBG05.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\rBG05a.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\remilia2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\shadow.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\shadow2.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st00.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st01.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st02.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st04.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st04a.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st04b.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st05.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\st07.png");
        DeleteGraphic(GetCurrentScriptDirectory~"\img\Tiiiiilllll.png");
        DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm1.mp3");
        DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm2.mp3");
        DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm3.mp3");
        DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm4.mp3");
        DeleteMusic(GetCurrentScriptDirectory~"\bgm\bgm5.mp3");
        if (replay<=0) {
            if (GetCommonDataDefaultEx("Spell","HighScore",0)>GetCommonDataDefaultEx("Spell","HighScore_before",0)) {
                SetCommonDataEx("Spell","HighScore_before",GetCommonDataDefaultEx("Spell","HighScore",0));
            }
        }
        SetCommonDataEx("Spell","HighScore",0);
        SaveCommonDataEx("Spell",pass);
        DeleteCommonData("ii1");
        DeleteCommonData("ii2");
        DeleteCommonData("ii3");
        DeleteCommonData("x");
        DeleteCommonData("y");
        DeleteCommonData("fs");
        DeleteCommonData("ddffffffffrrr");
        DeleteCommonData("last");
        DeleteCommonData("flash");
        DeleteCommonData("flash2");
        DeleteCommonData("Black");
        DeleteCommonData("Zatsuyou");
        DeleteCommonData("Zatsuyou2");
        DeleteCommonData("Go");
        DeleteCommonData("Mode");
        DeleteCommonData("P01");
        DeleteCommonData("P02");
        DeleteCommonData("P03");
        DeleteCommonData("P04");
        DeleteCommonData("P05");
        DeleteCommonData("bgh");
        DeleteCommonData("miss");
        DeleteCommonData("bomb");
    }

}
