
script_enemy_main
{
    let count=0;
    let count2=0;
    let count3=0;
    let count4=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 img=GetCurrentScriptDirectory~"\img\JUUJI.png";
    let bg=GetCurrentScriptDirectory~"img\st00.png";
    let bg2=GetCurrentScriptDirectory~"img\moon3-1.png";
    let bg3=GetCurrentScriptDirectory~"img\cloud.png";

    let sh00=GetCurrentScriptDirectory~"\se\Shot00.wav";
    let Beem=GetCurrentScriptDirectory~"\se\Laser.wav";

    let mm=0;
    let shot=0;
    let tame=0;
    let tame2=0;
    let pat=0;
    let d=70;
    let ten=0;
    let damage=0;

#include_function ".\BGfx.txt"

    @Initialize()
    {
        if (GetY>=-300) {
            MagicCircle(false);
            SetEnemyMarker(true);
            SetCommonData("Go",0);
        }
        SetLife(10);
        SetDamageRate(0,0);
        SetInvincibility(550);
        SetNormPoint(-1);
        LoadGraphic(img);
        SetShotAutoDeleteClip(32,32,32,32);
        SetMovePositionRandom01(0,200,5,GetX,GetY-44,GetX,GetY-44);
        move=70;

    }

    @MainLoop()
    {

        SetCommonData("Black",222);
        if (count4>=100) {
            AddLife(-100);
        }


        count++;
        count4++;
        count2++;
        move--;
        yield;
    }

    @Finalize()
    {
        SetEnemyMarker(false);
    }

    @DrawLoop()
    {
        if (count4<=210) {
            SetTexture(GetCurrentScriptDirectory~"\img\dot_remilia.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%4>=0) {
                SetGraphicRect(0,0,128,128);
            }
            if (int(GetSpeedX())==0&&count2/12%4>=1) {
                SetGraphicRect(0,128,128,256);
            }
            if (int(GetSpeedX())==0&&count2/12%4>=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*3,0,128*4,128);
            }
            if (tame2>32) {
                SetGraphicRect(128*3,128,128*4,256);
            }
            if (tame2>42) {
                SetGraphicRect(128*3,256,128*4,384);
            }
            if (ten==1) {
                SetColor(160,160,180);
            }
            if (pat==5&&count4>=120) {}else {
                DrawGraphic(GetX(),GetY());
            }
        }

    }


}

