
script_enemy_main
{
    let count=0;
    let count2=0;
    let count3=0;
    let count4=0;
    let huttobi=0;
    let huttobi2=0;
    let huttobi3=0;
    let huttobi4=0;
    let ang=270;
    let alp=250;
    let sAng=0;
    let ye=0;
    let ye2=0;
    let get;
    let try;
    let life=0;
    let item=0;
    let c=0;

    let move=0;

    let pass=GetCurrentScriptDirectory~"Spell.dat";

    let cx=GetCenterX();
    let mm=0;
    let shot=0;
    let tame=0;
    let tame2=0;
    let pat=0;
    let d=70;
    let ten=0;
    let damage=0;

    task CreateShot021(let x, let y, let speed, let angle, let Accelerate, let MaxSpeed, let grf, let delay)
    {
        let obj = Obj_Create(OBJ_SHOT);
        let N15 = 0;
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, speed);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, grf);
        ObjShot_SetDelay(obj, delay);
        ObjShot_SetBombResist(obj,true);
        if (Accelerate<0) {
            N15=1;
        }
        if (Accelerate>0) {
            N15=2;
        }
        while ( !Obj_BeDeleted(obj) )
        {
            if (speed>MaxSpeed&&N15==1) {
                Obj_SetSpeed(obj, speed+Accelerate);
            }
            if (speed<MaxSpeed&&N15==1) {
                Obj_SetSpeed(obj, MaxSpeed);
            }
            if (speed<MaxSpeed&&N15==2) {
                Obj_SetSpeed(obj, speed+Accelerate);
            }
            if (speed>MaxSpeed&&N15==2) {
                Obj_SetSpeed(obj, MaxSpeed);
            }
            yield;
        }
    }

    task Homing(let x, let y, let speed, let angle, let delay)
    {
        //弾タスク初期化
        let count = 0;
        let obj = Obj_Create(OBJ_SHOT);//弾オブジェクトを作成
        Obj_SetX(obj, x);//x座標設定
        Obj_SetY(obj, y);//y座標設定;
        Obj_SetSpeed(obj, speed);//速度設定
        Obj_SetAngle(obj, angle);//移動角度設定
        ObjShot_SetGraphic(obj, 255);//画像設定
        ObjShot_SetDelay(obj, delay);//遅延時間設定
        let dAngle=2;

        while ( !Obj_BeDeleted(obj) )
        {
            //ホーミング
            let toAngle=atan2(GetPlayerY()-Obj_GetY(obj), GetPlayerX()-Obj_GetX(obj));
            if (toAngle>=360) {
                toAngle-=360;
            }
            if (toAngle<0) {
                toAngle+=360;
            }
            let ret=toAngle-angle;
            if ((ret>0&&ret<=180)||(ret<=0&&ret<=-180)) {
                angle+=dAngle;
            }
            if ((ret>0&&ret>180)||(ret<=0&&ret>-180)) {
                angle-=dAngle;
            }
            if (angle>=360) {
                angle-=360;    //360°以上なら0〜360内に補正
            }
            if (angle<0) {
                angle+=360;    //0°未満なら0〜360内に補正
            }
            Obj_SetAngle(obj, angle);
            Obj_SetSpeed(obj, speed);
            ObjShot_SetBombResist(obj,true);
            if (count>=9&&dAngle>0.2) {
                dAngle-=0.1;
                speed-=0.2;
            }
            if (count>=9&&dAngle<=0.2) {
                dAngle=0.2;
            }
            if (count>=120) {
                speed+=0.005;
            }
            count++;
            yield;
        }
    }


    function CreateWayShot02(Way,Gap,PosX,PosY,Dist,Speed,Angle,Accelerate,MaxSpeed,Graphic,Delay) {
        if (Graphic==100) {
            ascent(let i in 0..Way) {
                CreateShot021(PosX+Dist*cos(Angle+Gap*(i+0.5-(Way * 0.5))),PosY+Dist*sin(Angle+Gap*(i+0.5-(Way * 0.5))),Speed,Angle+Gap*(i+0.5-(Way*0.5)),Accelerate,MaxSpeed,Graphic,Delay);
            }
        }
        else {
            ascent(let i in 0..Way) {
                CreateShot02(PosX+Dist*cos(Angle+Gap*(i+0.5-(Way * 0.5))),PosY+Dist*sin(Angle+Gap*(i+0.5-(Way * 0.5))),Speed,Angle+Gap*(i+0.5-(Way*0.5)),Accelerate,MaxSpeed,Graphic,Delay);
            }
        }
    }

#include_function ".\BGfx.txt"

    @Initialize()
    {
        if (GetY>=-300) {
            MagicCircle(false);
            SetEnemyMarker(true);
            SetCommonData("P01",0);
            SetCommonData("P02",0);
            SetCommonData("P03",0);
            SetCommonData("P04",0);
            SetCommonData("P05",0);
            SetCommonData("Go",0);
        }
        SetLife(19000);
        SetDamageRate(900,100);
        //SetTimer(20000);
        SetInvincibility(150);
        SetNormPoint(-1);
        SetShotAutoDeleteClip(32,32,32,32);
        SetMovePositionRandom01(0,200,5,cx,150,cx,150);
        LoadUserShotData(GetCurrentScriptDirectory~".\shot_All.txt");

    }

    @MainLoop()
    {
        if (count%4==0) {
            life=GetLife();
        }c+=7;
        if (GetLife()>=200&&GetLife()<=2550&&count%4==3&&GetLife()<life) {
            SetDamageRate(0.1,0.1);
            AddLife(-80);
        }
        if (count%4==3&&GetLife()<life) {
            ten=1;
        }

        if (ten==1&&count%4==1) {
            ten=0;
        }

        if (GetCommonDataDefault("P01",0)==2&&huttobi==0) {
            SetSpeed(0);
            SetMovePositionRandom01(45,0,8,GetX()+55,GetY+28,GetX()+55,GetY+28);
            huttobi=1;
            move=120;
        }
        if (GetCommonDataDefault("P02",0)==2&&huttobi2==0) {
            SetSpeed(0);
            SetMovePositionRandom01(45,0,8,GetX()-55,GetY+28,GetX()-55,GetY+28);
            huttobi2=1;
            move=120;
        }

        if (ye2>0) {
            SetCommonData("P03",1);
        }else {
            SetCommonData("P03",0);
        }



        if (pat==0)
        {

            if (count4==0&&move<=0)
            {
                SetSpeed(0);
                SetMovePositionRandom01(85,55,3,GetCenterX(),160,GetCenterX(),160);
                move=80;
            }

            if (count4>120&&count4<140&&ang>90) {
                ang-=10;
            }

            if (count4>90&&count4<240&&alp>0) {
                alp-=5;
            }

            if (count4==140&&move<=0)
            {
                SetSpeed(0);
                SetMovePositionRandom01(85,55,3,GetCenterX(),140,GetCenterX(),140);
                move=80;
            }

            if (count4>140&&count4<=156) {
                ye2+=5;
            }

            if (count4==150)
            {
                tame=0;
                tame+=GetAngleToPlayer();
            }

            if (count4>150&&count4<420&&count%13==7) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
                CreateWayShot02(2,44,GetX,GetY-8,0,9,tame,-1,5,175,0);
                CreateWayShot02(1,0,GetX,GetY-8,0,9,tame,-1,5,175,0);
            }

            if (count4>150&&count4<420&&count%13==4) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
                CreateWayShot02(2,22,GetX,GetY-8,0,9,tame,-1,5,175,0);
            }

            if (count4>150&&count4<420&&count%12==5) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                if (GetCommonDataDefault("P02",0)!=2) {
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()+65,GetY()-55,0,90,0.5);
                }
                if (GetCommonDataDefault("P01",0)!=2) {
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-65,GetY()-55,0,90,0.5);
                }
            }

            if (count4>150&&count4<420&&count%12==10) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                if (GetCommonDataDefault("P02",0)!=2) {
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()+100,GetY()-20,0,85,0.5);
                }
                if (GetCommonDataDefault("P01",0)!=2) {
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-100,GetY()-20,0,95,0.5);
                }
            }

            if (count4>=70&&count<410) {
                tame2++;
            }
            if (count4>420) {
                pat=1;
                count4=0;
                tame2=0;
            }
            if (GetLife()<20) {
                pat=5;
                count4=0;
                tame2=0;
            }
        }








        if (pat==1)
        {

            if (count4<120&&ye2>0) {
                ye2-=5;
            }

            if (count4==120||count4==360||count4==450)
            {
                tame=0;
                tame+=GetAngleToPlayer();
            }

            if (count4>0&&count4<50&&count4%9==4) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-1,GetY()+65,-2,90+rand(-11,11),0.5);
            }

            ascent( let t in 0..12 ) {
                if (tame>(t*30)-15&&tame<(t*30)+15) {
                    sAng=(t*30);    //偏差
                }
            }

            if (count4>120&&count4<250&&count%6==3&&GetSpeedX==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateWayShot02(2,70,GetX,GetY+46,0,4.5,90,0,8,175,3);
                CreateWayShot02(1,46,GetX,GetY+46,0,4.5,90,0,8,175,3);
            }

            if (count4>120&&count4<250&&count%6==0&&GetSpeedX==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateWayShot02(2,35,GetX,GetY+46,0,4.5,90,0,8,175,3);
            }

            if (count4>=360&&count4<500&&count4%20==4&&count4!=424) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
                CreateWayShot02(5,15,GetX-22,GetY-12,0,4.4,sAng-34,0,8,175,3);
                CreateWayShot02(5,15,GetX+22,GetY-12,0,4.4,sAng+34,0,8,175,3);
                CreateWayShot02(5,15,GetX-22,GetY-12,0,3.2,sAng-34,0,8,175,3);
                CreateWayShot02(5,15,GetX+22,GetY-12,0,3.2,sAng+34,0,8,175,3);
            }

            if (count4>250&&count4<266) {
                ye2+=5;
            }

            if (count4>320&&count4<336) {
                ye2-=5;
            }

            if (count4>260&&count4<290&&count%10==1&&GetCommonDataDefault("P02",0)!=2) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()+65,GetY()-55,2,90,0.5);
            }

            if (count4>260&&count4<290&&count%10==1&&GetCommonDataDefault("P01",0)!=2) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-65,GetY()-55,2,90,0.5);
            }

            if (count4>260&&count4<290&&count%10==4&&GetCommonDataDefault("P02",0)!=2) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()+115,GetY()-20,2,90,0.5);
            }

            if (count4>260&&count4<290&&count%10==4&&GetCommonDataDefault("P01",0)!=2) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-115,GetY()-20,2,90,0.5);
            }

            if (count3<800&&count4>290&&count4<340&&count4%9==4) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-1,GetY()+65,-2,90+rand(-11,11),0.5);
            }

            if (count3>860&&count3%16==8) {
                ye2=20;
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-26,GetY()-15,-5,90,0.5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()+26,GetY()-15,-5,90,0.5);
            }

            if (count2>2060&&count3%16==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-26,GetY()-15,-5,90,0.5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()+26,GetY()-15,-5,90,0.5);
            }

            if (count4==120||count4==450&&move<=0)
            {
                SetSpeed(0);
                SetMovePositionRandom01(85,rand(50,150),2,GetPlayerX()-33,110,GetPlayerX()+33,150);
                move=80;
            }
            if (count4==365&&move<=0)
            {
                SetSpeed(0);
                SetMovePositionRandom01(85,rand(50,150),1,GetCenterX()+(GetX()-GetCenterX())/2,110,GetCenterX()+(GetX()-GetCenterX())/2,150);
                move=80;
            }
            if (count4>=520) {
                count4=80;
            }count3++;
            if (count3==800&&GetCommonDataDefault("P01",0)!=2) {
                SetCommonData("P01",3);
                huttobi=1;
            }
            if (count3==800&&GetCommonDataDefault("P02",0)!=2) {
                SetCommonData("P02",3);
                huttobi2=1;
            }
            if (count3<800&&GetCommonDataDefault("P01",0)==2&&GetCommonDataDefault("P02",0)==2) {
                count3=800;
            }

            if (GetLife()<200) {
                pat=5;
                count4=0;
            }
        }



        if (count2>=2&&GetY<-300) {
            VanishEnemy;
        }


        if (count2==2200&&pat!=5) {
            count2=9000;
            pat=6;
            count4=0;
        }


        if (pat==5)//おわり
        {
            SetEnemyMarker(false);
            AddLife(5-GetLife);
            move=300;
            if (count4==120) {
                SetCommonData("Go",1);
            }
            if (count4>120) {
                count3-=2;
            }
            if (count4==20&&GetCommonDataDefault("P01",0)!=2) {
                SetCommonData("P01",3);
            }
            if (count4==40&&GetCommonDataDefault("P02",0)!=2) {
                SetCommonData("P02",3);
            }
            if (count4==0) {
                if (item!=1&&GetCommonDataDefault("P01",0)==2&&GetCommonDataDefault("P02",0)==2&&GetCommonDataDefault("P03",0)==2&&GetCommonDataDefault("P04",0)==2) {
                    item=2;
                }
                SetSpeed(0);
                SetMovePositionRandom01(45,0,8,GetX(),GetY-20,GetX(),GetY-20);
                DeleteEnemyShotToItemInCircle(CHILD,GetX(),GetY(),500);
                PlaySE(GetCurrentScriptDirectory~"\se\Baaaaaaaan.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,4);
            }
            if (count4<=120&&count%15==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Baaaan2.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX+rand(-73,73),GetY+rand(-93,53),0,0,2);
            }
            if (count4>=240) {
                SetEnemyMarker(false);
                VanishEnemy;
            }
            if (count4==120) {
                PlaySE(GetCurrentScriptDirectory~"\se\bom13.wav");
                SetCommonData("flash2",255);
                if (count2<=8000) {
                    AddScore(10000000);
                    loop(100) {
                        CreateItem(ITEM_SCORE,GetX()+rand(-150,150),GetY()+rand(-90,135));
                    }
                    CreateItem(ITEM_1UP,GetX(),GetY()+35);
                }
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,4);
            }
        }

        if (pat==6)//おわり
        {
            SetDamageRate(0,0);
            if (count4==0&&GetCommonDataDefault("P01",0)!=2) {
                SetCommonData("P01",3);
            }
            if (count4==0&&GetCommonDataDefault("P02",0)!=2) {
                SetCommonData("P02",3);
            }
            if (count4<140&&count4>10&&count4%6==3) {
                MagicCircle(false);
                SetEnemyMarker(false);
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()-26,GetY()-15,-5,GetAngleToPlayer(),0.5);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX()+26,GetY()-15,-5,GetAngleToPlayer(),0.5);
            }
            if (count4>=50)
            {
                SetSpeed(0);
                SetMovePositionRandom01(0,0,1.5,GetPlayerX(),-200,GetPlayerX(),-200);
                move=80;
            }
            if (count4>=340) {
                SetEnemyMarker(false);
                SetCommonData("Go",1);
                VanishEnemy;
            }
        }




        if (count>=120&&GetLife()>200&&pat!=6) {
            SetCollisionA(GetX(),GetY()+26,36);
            SetCollisionA(GetX(),GetY()-11,22);
            SetCollisionB(GetX(),GetY(),22);
        }

        count++;
        count4++;
        count2++;
        move--;
        if (ye>0) {
            ye-=4;
        }
        if (ye<0) {
            ye=0;
        }
        if (ye2>0&&ye<244) {
            ye+=6;
        }

        //if(count3<800&&pat!=5&&count2>140&&GetCommonDataDefault("P04",0)==0&&GetCommonDataDefault("P01",0)!=1){
        //CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",0,-110,0,0,4);}
        //if(count3<800&&pat!=5&&count2>140&&GetCommonDataDefault("P05",0)==0&&GetCommonDataDefault("P02",0)!=2){
        //CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",0,-110,0,0,5);}
        SetCommonData("P04",0);
        SetCommonData("P05",0);
        if (count2==130) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",0,-110,0,0,4);
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant06.txt",0,-110,0,0,5);
        }
        SetCommonData("x",GetX);
        SetCommonData("y",GetY);
        yield;
    }

    @Finalize()
    {
        SetEnemyMarker(false);
    }

    @DrawLoop()
    {
        if (pat!=5) {
            SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
            if (count<100) {
                SetColor(0,0,0);
            }
            if (count>=100) {
                SetAlpha((count-100)*2.5);
                SetColor((count-100)*1.2,(count-100)*1.2,(count-100)*1.2);
            }
            if (count>=200) {
                SetAlpha(255);
                SetColor(255,255,255);
            }
            SetGraphicAngle(0,0,0);
            SetRenderState(ADD);
            SetGraphicRect(0,48,48,96);
            SetGraphicScale(1.3,1.3);
            if (ten==1) {
                SetColor(110,110,180);
            }
            if (count>100) {
                DrawGraphic(GetX(),GetY()+46);
                DrawGraphic(GetX(),GetY()-42);
            }
        }

        SetTexture(GetCurrentScriptDirectory~"\img\JUUJI.png");
        SetRenderState(ADD);
        SetGraphicScale(1.3,1.3);
        if (GetCommonDataDefault("P01",0)!=2) {
            SetGraphicRect(288,352,352,464);
            SetGraphicAngle(0,0,ang-90+ye2);
            if (count<=70) {
                SetAlpha(0);
                SetColor(0,0,0);
            }
            if (count>=70) {
                SetAlpha((count-70)*2.5);
                SetColor((count-70)*1.2,(count-70)*1.2,(count-70)*1.2);
            }
            if (count>=170) {
                SetAlpha(255);
                SetColor(255,255,255);
            }
            if (GetCommonDataDefault("P01",0)==1) {
                SetColor(50,20,120);
            }
            DrawGraphic(GetX()-(40+ye2/3)*cos(ang-90),GetY()-(36+ye2/3)*sin(ang-90)-ye2/2);
        }

        if (GetCommonDataDefault("P02",0)!=2) {
            SetGraphicRect(416,352,480,464);
            SetGraphicAngle(0,0,ang-90-ye2);
            if (count<=70) {
                SetAlpha(0);
                SetColor(0,0,0);
            }
            if (count>=70) {
                SetAlpha((count-70)*2.5);
                SetColor((count-70)*1.2,(count-70)*1.2,(count-70)*1.2);
            }
            if (count>=170) {
                SetAlpha(255);
                SetColor(255,255,255);
            }
            if (GetCommonDataDefault("P02",0)==1) {
                SetColor(50,20,120);
            }
            DrawGraphic(GetX()+(40+ye2/3)*cos(ang-90),GetY()+(36+ye2/3)*sin(ang-90)-ye2/2);
        }

        if (GetEnemyLife>0) {
            SetTexture(GetCurrentScriptDirectory~"\img\circle_l.png");
            SetGraphicAngle(0,0,-c);
            SetGraphicRect(0,0,256,256);
            SetAlpha(255);
            SetRenderState(ADD);
            SetColor(160+20*sin(c),160+20*sin(c),160+20*sin(c));
            if (count<=1) {
                SetGraphicScale(0,0);
            }
            if (count>1) {
                SetGraphicScale(0.02*count,0.02*count);
            }
            if (count>=50) {
                SetGraphicScale(1.0+0.1*sin((count-50)*3),1.0+0.1*sin((count-50)*3));
            }
            if (pat==5&&count4>=120) {}else {
                DrawGraphic(GetX(),GetY());
            }
        }

        /*SetTexture(GetCurrentScriptDirectory~"\img\dot_sakuya.png");
        SetAlpha(255);
        SetGraphicAngle(0,0,0);
        SetColor(255,255,255);
        SetRenderState(ALPHA);
        SetGraphicScale(1,1);
        SetGraphicRect(0,0,128,128);
        if(int(GetSpeedX())==0&&count2/12%3>=0){SetGraphicRect(0,0,128,128);}
        if(int(GetSpeedX())==0&&count2/12%3>=1){SetGraphicRect(0,128,128,256);}
        if(int(GetSpeedX())==0&&count2/12%3>=2){SetGraphicRect(0,256,128,384);}
        //if(int(GetSpeedX())==0&&count2/12%4>=3){SetGraphicRect(0,384,128,512);}
        if(GetSpeedX()<0&&move>0){SetGraphicRect(256,0,384,128);}
        if(GetSpeedX()<0&&move>8){SetGraphicRect(256,128,384,256);}
        if(GetSpeedX()>=0&&move>0){SetGraphicRect(256,256,384,384);}
        if(GetSpeedX()>=0&&move>8){SetGraphicRect(256,384,384,512);}
        if(tame2>0){SetGraphicRect(128*4,0,128*5,128);}
        if(tame2>60){SetGraphicRect(128*4,128,128*5,256);}
        if(tame2>65){SetGraphicRect(128*5,0,128*6,128);}*/

        SetTexture(GetCurrentScriptDirectory~"\img\dot-kaze-ti.png");
        SetColor(255,255,255);
        SetAlpha(255);
        SetGraphicAngle(0,0,0);
        if (pat==5) {
            SetGraphicAngle(0,0,rand(-11,11));
            SetColor(255,155,155);
        }
        SetRenderState(ALPHA);
        SetGraphicScale(1,1);
        if (count/6%4>=0) {
            SetGraphicRect(256,0,320,64);
        }
        if (count/6%4>=1) {
            SetGraphicRect(320,0,384,64);
        }
        if (count/6%4>=2) {
            SetGraphicRect(384,0,448,64);
        }
        if (count/6%4>=3) {
            SetGraphicRect(320,0,384,64);
        }

        if (ten==1) {
            SetColor(60,60,180);
        }
        if (pat==5&&count4>=120) {}else {
            DrawGraphic(GetX(),GetY());
        }

    }


}

