script_enemy_main
{
        #include_function ".\lib\sub.h.txt"
        let csd        = GetCurrentScriptDirectory;
	let ImgEnemy= csd~".\img\faily_red.png";
        let shotData   = csd ~ "kshotData.txt";
        let tame       =csd~"se\shot2.wav";

	let count      =3;
	let counta      =0;
	let couns      =0;
	let counsa      =0;
        let sp=0;
        let an=0;

	let angle     =  270;
	let SIN       =  160;
	let cx         =GetCenterX();

	@Initialize()
	{
		SetLife(20);
		LoadUserShotData(shotData);
		LoadGraphic(ImgEnemy);
                SetInvincibility(20);
	}
	
	@MainLoop
	{
	        
                SetShotDirectionType(ABSOLUTE);


		if(counta==220)
		{
                  count=0;
		}
		if(count==2)
		{
                  count=0;
		}

		if(count==60)
		{
                let i=-80;
                let k=0;
                loop(7){
                  i+=20;
                  k+=0.5;
                PlaySE(tame);
		CreateShotA(01,GetX,GetY,10);
		SetShotDataA(01,0,2,GetAngleToPlayer+i,0,-0.1,2,23);
                FireShot(01);
		CreateShotA(02,GetX,GetY,10);
		SetShotDataA(02,0,4,GetAngleToPlayer+i,0,-0.1,2,23);
                FireShot(02);
		CreateShotA(03,GetX,GetY,10);
		SetShotDataA(03,0,5,GetAngleToPlayer+i,0,-0.1,2,23);
                FireShot(03);
		}
               }


              /////////////////////////////////////////////

		if(counsa==17)
		{
                  couns=17;
		}
		if(counsa==27)
		{
                  couns=27;
		}

		if(couns==1)
		{
                      sp+=0.5;
                  SetSpeed(10-sp);
                  couns=0;
		}
		if(couns==17)
		{
                      sp+=0.2;
                  SetSpeed(10-sp);
                  couns=16;
		}

		if(couns==61)
		{
                  sp=0;
		}
		if(couns==300)
		{
                      sp+=0.05;
                      an+=1;
                  SetSpeed(-0.3+sp);
                  SetAngle(20);
                  couns=299;
		}

		if(counsa==500)
		{
			VanishEnemy;
		}
              /////////////////////////////////              

             if(GetY>=cy-240 && GetX>=cx-190 && GetX<=cx+190)
             {
		SetCollisionA(GetX(),GetY(),24);//eo^
		SetCollisionB(GetX(),GetY(),10);//̓o^
             }
		count++;
		counta++;
		couns++;
		counsa++;
	}
	
	@DrawLoop
	{
		Drawfaily(ImgEnemy,4);
	}
	@Finalize
	{
             if(GetY>=cy-250 && GetX>=cx-220 && GetX<=cx+220)
             {
		loop(1)
		{
			CreateItem(ITEM_SCORE,rand(GetX-30,GetX+30),rand(GetY-30,GetY+30));
		}
              }
	}
}