script_enemy_main {
    let time = 0;
    let phase = 1;
    let rate = 0;
    let life = 0;
    let kaku = 10;
    let score = 2000;
    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 se3 = GetCurrentScriptDirectory~"wav\se3.wav";
    @Initialize(){
        SetLife( 1000 );
        SetInvincibility( 10 );
        LoadGraphic( imgEnemy );
        LoadUserShotData( tama );
        SetX(mapx-GetCommonData("bgx"));
        SetY(GetCommonData("bgy")-mapy);
    }
    @MainLoop {
        rate=life-GetLife;
        life=GetLife;
        if(phase==1&&rate%1>0){
           phase-=1;
           PlaySE(se3);
           Tdeath(4,24,2,1);
           if(rate%1>0){Tkunsyon(10,2);}
        }
        if(GetX<12||GetX>436||GetY<16){
           SetInvincibility( 5 );
        }
        if(time>240&&GetY>500){VanishEnemy;}
        if(time>1600){VanishEnemy;}
        if(phase>=1&&GetTimeOfPlayerInvincibility>0){SetCollisionA(GetX, GetY, 32);}
        SetX(mapx-GetCommonData("bgx"));
        SetY(GetCommonData("bgy")-mapy);
        lv=GetCommonData("rank");
        time++;
        yield;
    }
    @Finalize() {
    }
    @DrawLoop {
	SetTexture( imgEnemy );
        SetGraphicRect( 1, 1, 80, 96 );
        SetGraphicAngle(0,0,0);
	DrawGraphic( GetX(), GetY() );
    }



    #include_function".\efanction.txt"
}

#include_script".\escript.txt"