script_enemy_main {
    let time = 0;
    let phase = 1;
    let rate = 0;
    let kaku = 10;
    let score = 180;
    let lv = 0;
    let nokori = 150;
    let angle = GetAngle();
    let rank = GetSpeed();
    let arg = GetArgument();
    let ex = GetCommonData("ex");
    let mapx = GetX();
    let mapy = GetY();
    let imgEnemy = GetCurrentScriptDirectory~"img\izumi.png";
    let tama = GetCurrentScriptDirectory~"tama.txt";
    let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
    let se3 = GetCurrentScriptDirectory~"wav\se3.wav";
    @Initialize(){
        SetLife( 300 );
        SetInvincibility( 0 );
        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+10, 70);}
           PlaySE(se3);
           Tdeath(4,30,2,0);
           time=0;
        }
        if(GetX<12||GetX>436||GetY<5){
           SetInvincibility( 5 );
        }
        if(time>240&&GetY>500){VanishEnemy;}
        if(time>1600||nokori<=0){VanishEnemy;}
        if(phase>=1&&GetCommonData("kakusei")==1&&GetPoint>0){SetCollisionA(GetX, GetY, 40);}
        if(phase==0&&GetX>16&&GetX<432&&GetY<480&&time%3>0&&nokori>0){
           CreateShotFromScript( "isi",GetX()+rand(40,-40), GetY()+rand(40,-40), 0, 0, 0, 0);
           nokori--;
        }
        SetX(mapx-GetCommonData("bgx"));
        SetY(GetCommonData("bgy")-mapy);
        if(GetCommonData("kakusei")>0){lv=1}
        else{lv=0}
        time++;
        yield;
    }
    @Finalize() {
    }
    @DrawLoop {
        if(phase==1&&GetCommonData("kakusei")==1&&GetPoint>0){
	SetTexture( imgEnemy );
        SetGraphicRect( 1, 1, 64, 64 );
        SetGraphicAngle(0,0,time*8);
        SetAlpha(50);
	DrawGraphic( GetX(), GetY() );
        }
        if(phase==0){
	SetTexture( imgEnemy );
        SetGraphicRect( 1, 1, 64, 64 );
        SetGraphicAngle(0,0,time*8);
        SetAlpha(255);
	DrawGraphic( GetX(), GetY() );
        }
    }



    #include_function".\efanction.txt"
}

#include_script".\escript.txt"