script_enemy_main {
    let time = 0;
    let phase = 1;
    let rate = 20;
    let kaku = 10;
    let score = 180;
    let lv = 0;
    let angle = GetAngle();
    let rank = GetSpeed();
    let arg = GetArgument();
    let ex = GetCommonData("ex");
    let mapx = GetX();
    let mapy = GetY();
    let imgEnemy = GetCurrentScriptDirectory~"img\obj2.png";
    let tama = GetCurrentScriptDirectory~"tama.txt";
    let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
    let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
    @Initialize(){
        SetLife( 200 );
        SetInvincibility( 10 );
        LoadGraphic( imgEnemy );
        LoadUserShotData( tama );
        SetX(mapx-GetCommonData("bgx"));
        SetY(GetCommonData("bgy")-mapy);
    }
    @MainLoop {
        if(phase==1&&GetLife<=100){
           phase-=1;
           if(lv==0||GetPoint>0){
              DeleteEnemyShotImmediatelyInCircle(SHOT, GetX, GetY, 70);
           }
           PlaySE(se2);
           Tdeath(20,64,1,1);
        }
        if(GetX<12||GetX>436||GetY<90){
           SetInvincibility( 5 );
        }
        if(time>240&&GetY>580){VanishEnemy;}
        if(time>1600){VanishEnemy;}
        if(phase>=1){
           SetCollisionA(GetX, GetY, 50);
        }
        SetX(mapx-GetCommonData("bgx"));
        SetY(GetCommonData("bgy")-mapy);
        if(GetCommonData("kakusei")>0){lv=1}
        else{lv=0}
        time++;
        yield;
    }
    @Finalize() {
    }
    @DrawLoop {
	SetTexture( imgEnemy );
        SetGraphicRect( 0, 0, 80, 96 );
	DrawGraphic( GetX(), GetY() );
    }


    #include_function".\efanction.txt"
}

#include_script".\escript.txt"