
script_enemy_main
{
    let count=0;
    let count2=0;
    let count3=0;
    let mm=0;
    let mm2=0;
    let get;
    let try;

    let move=0;

    let pass=GetCurrentScriptDirectory~"Spell.dat";

    let cx=GetCenterX();
    let img=GetCurrentScriptDirectory~"img\dot_remilia.png";
    let bg=GetCurrentScriptDirectory~"img\st00.png";
    let bg2=GetCurrentScriptDirectory~"img\moon3-1.png";
    let bg3=GetCurrentScriptDirectory~"img\cloud.png";

    let WALL_TOP = 8;
    let WALL_LEFT = 4;
    let WALL_RIGHT = 2;
    let WALL_BOTTOM = 1;

    let mm=0;
    let shot=0;
    let ang=0;
    let MT=0;

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

        while ( !Obj_BeDeleted(obj) )
        {
            yield;
        }
    }

    @Initialize()
    {
        SetLife(5000);
        AddLife(-4998);
        MagicCircle(false);
        SetDamageRate(0,0);
        SetTimer(500);
        SetInvincibility(800);
        LoadGraphic(img);
        LoadGraphic(GetCurrentScriptDirectory~"\img\circle_l.png");
        LoadUserShotData(GetCurrentScriptDirectory~".\shot_All.txt");

    }

    @MainLoop()
    {
        if (count==0) {
            SetEnemyMarker(false);
            SetSpeed(0);
            SetMovePositionRandom01(45,0,8,GetCenterX(),GetY-10,GetCenterX(),GetY-10);
            DeleteEnemyShotToItemInCircle(CHILD,GetX(),GetY(),500);
            PlaySE(GetCurrentScriptDirectory~"\se\Baaaaaaaan.wav");
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,4);
        }
        if (count>30&&count%15==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Baaaan2.wav");
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX+rand(-43,43),GetY+rand(-43,43),0,0,2);
        }
        if (count==120) {
            SetSpeed(0);
            SetMovePositionRandom01(45,0,3,GetCenterX(),-180,GetCenterX(),-180);
        }
        if (count==200) {
            SetSpeed(0);
            SetMovePositionRandom01(45,0,6,GetCenterX(),-180,GetCenterX(),-180);
        }
        if (count>=260) {
            VanishEnemy;
        }
        count++;
        yield;
    }

    @Finalize()
    {}

    @DrawLoop()
    {
        if (GetEnemyLife>0) {
            SetTexture(GetCurrentScriptDirectory~"\img\circle_l.png");
            SetGraphicAngle(0,0,count*7);
            SetGraphicRect(0,256,256,512);
            SetAlpha(255);
            SetRenderState(ADD);
            SetColor(255,255,255);
            SetGraphicScale(1.0,1.0);
            DrawGraphic(GetX(),GetY());
        }

    }


}

