script_enemy_main
{
    let count=0;//”wŒi‹…
    let S=0;//‘¬“x
    let N15=0;
    let N17=0;
    let life=0;
    let ten=0;

function dead {

    SetDamageRate(0,0);
    PlaySE(GetCurrentScriptDirectory~"\se\bom27_b.wav");
    if (N17==50) {
        AddScore(200000);
        if (BeVanished==false) {
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Missile.txt",GetX(),GetY(),0,0,1);
        }
    }

    if (N17<100) {
        N17+=50;
    }
    if (N17>=100) {
        VanishEnemy;
    }
}


@Initialize
{
    SetLife(5460);
    SetDamageRate(100,5);
    S=GetSpeed;
}


@MainLoop
{
    if (count%4==0) {
        life=GetLife();
    }if (ten==1&&count%4==1) {
        ten=0;
    }
    if (count%4==3&&GetLife()<life&&GetLife()>0) {
        ten=1;
    }

    if (GetArgument<=1) {
        if (GetLife<5400) {
            dead;
        }
        if (count==63||count==150||count==250)
        {
            N15=0;
            N15+=GetAngleToPlayer();
        }
        if (count>=63&&count<=79&&count%4==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Laser.wav");
            CreateShot01(GetX()+9*cos(N15),GetY()+9*sin(N15),4.5,N15,89,4);
        }
        if (GetArgument==1) {
            if (count>=150&&count<=164&&count%4==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Laser.wav");
                CreateShot01(GetX()+9*cos(N15),GetY()+9*sin(N15),4.5,N15,89,4);
            }
            if (count>=250&&count<=264&&count%4==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Laser.wav");
                CreateShot01(GetX()+9*cos(N15),GetY()+9*sin(N15),4.5,N15,89,4);
            }
        }
        if (S>0&&count<120) {
            SetSpeed(S);
            S-=0.1;
        }
        if (count==85) {
            SetSpeed(0);
            SetMovePositionRandom01(rand(15,150),rand(15,150),8,GetCenterX()+(GetCenterX()-GetX()),GetPlayerY()-160,GetCenterX()+(GetCenterX()-GetX()),GetPlayerY()-30);
        }
        if (count==180) {
            SetSpeed(0);
            SetMovePositionRandom01(rand(15,150),rand(15,150),8,GetCenterX()+(GetCenterX()-GetX()),GetPlayerY()-160,GetCenterX()+(GetCenterX()-GetX()),GetPlayerY()-30);
        }
        if (count>=260) {
            SetAngle(90);
            SetSpeed(0.05*(count-260));
        }
        SetCollisionA(GetX(),GetY(),17);
        SetCollisionB(GetX(),GetY(),12);
        SetDamageRate(100,20);
        if (count<=40) {
            SetDamageRate(20,5);
        }
        if (count>400||GetY>520) {
            VanishEnemy;
        }
    }

    count++;
    yield;

}

@Finalize
{
}

@DrawLoop
{

    SetTexture(GetCurrentScriptDirectory~"\img\dot-kaze-ti.png");
    if (count>=0&&count<=24) {
        SetAlpha(count*10*((100-N17)/100));
    }
    if (count>=24) {
        SetAlpha(255*((100-N17)/100));
    }
    SetGraphicRect(64,64,128,128);
    SetRenderState(ALPHA);
    SetColor(225+count%4*30,225+count%4*30,225+count%4*30);
    if (ten==1) {
        SetColor(60,60,120);
    }
    SetGraphicScale(1.12,1.12);
    SetGraphicAngle(0,0,-count*5);
    DrawGraphic(GetX(),GetY());
    SetGraphicScale(0.8,0.8);
    SetGraphicAngle(0,0,count*5);
    DrawGraphic(GetX(),GetY());

    SetGraphicRect(0,64,64,128);
    SetColor(255*((100-N17)/100),255*((100-N17)/100),255*((100-N17)/100));
    if (ten==1) {
        SetColor(60,60,120);
    }
    SetGraphicScale(0.65,0.65);
    SetGraphicAngle(0,0,90);
    DrawGraphic(GetX(),GetY());

}
}
