script_enemy_main
{
	let count      =3;
	let counta      =0;
	let couns      =0;
	let counsa     =0;
        let sp=0;
        let an=GetAngle;
	let imga=0;
	let imgEnemy=GetCurrentScriptDirectory~"img\kiri2.png";
	let imgAngle=0;
        let csd        = GetCurrentScriptDirectory;
        let shotData   = csd ~ "kshotData.txt";
        let tame         =csd~"se\shot10.wav";
	let cx=GetCenterX();  
	let cy=GetCenterY(); 

	let Angle=GetAngle;
	let pangle=0;
	@Initialize
	{
		SetLife(20);    //ライフを1500に設定
		SetGraphicRect(1,1,98,94);//描画元矩形を設定	
		LoadUserShotData(shotData);
	}
	
	@MainLoop
	{



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

		if(count==60)
		{
                let i=-100;
                loop(3){
                  i+=50;
                PlaySE(tame);
		CreateShotA(01,GetX,GetY,10);
		SetShotDataA(01,0,5,an+i,0,-0.2,-1,23);
                FireShot(01);
		CreateShotA(02,GetX,GetY,10);
		SetShotDataA(02,0,5,an+i,0,-0.2,0.5,23);
                FireShot(02);
		CreateShotA(03,GetX,GetY,10);
		SetShotDataA(03,0,5,an+i,0,-0.2,1,23);
                FireShot(03);
		}
               }
		if(count==210)
		{
                loop(4){
                PlaySE(tame);
		CreateShotA(01,GetX,GetY,10);
		SetShotDataA(01,0,rand(6,3),rand(0,360),0,-0.2,0.5,43);
                FireShot(01);
		}
               }

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

		if(counsa==60)
		{
                  couns=60;
		}
		if(counsa==427)
		{
                  couns=427;
		}

		if(couns==0)
		{
                      sp+=0.1;
                  SetSpeed(5-sp);
                  couns=-1;
		}

		if(couns==300)
		{
	        imga+=2;
		SetColor(254-imga,254-imga,254-imga);
                  couns=299;
		}

		if(counsa==430)
		{
			VanishEnemy;
		}

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

		counta++;
		count++;
		couns++;
		counsa++;
	}

    // w フレームだけ待つ
    function wait(w) {
        loop(w) { yield; }
}
	
	@DrawLoop
	{//描画
		SetTexture(imgEnemy);
                SetGraphicScale(2,2);
		DrawGraphic(GetX(),GetY());
	}
	@Finalize
	{
			VanishEnemy;
	}
}