script_enemy_main
{
	let count=-60;
	let lv = GetCommonDataDefault("lv",2);
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SxW擾
	#include_function ".\lib\lib_anime_Remilia.txt"
	let imageBoss = ".\script\wx\img\dot_cirno.png";
	@Initialize{
		LoadGraphic(imageBoss);
		InitializeAction();
		SetLife(2000);
		SetTimer(30);
		SetDamageRate(100,100);
		SetMovePosition02(cx,100,60);
	}
	
	@MainLoop
	{
		if(0 < GetHitCount)
		{
			PlaySE(".\script\wx\sound\enemy_damage.wav");
		}
		if (GetTimer>0 && GetTimer<12 && count%60==0)
		{
			PlaySE(".\script\wx\sound\clock.wav");
		}
		count++;
		
		if (count>0) {
		if ((count%90==45 && lv>3) || (count%90==0 && lv>1) || (count%180==0 && lv==1))
		{
			let angle=0;
			SetAction(ACT_SHOT_B,30);
			PlaySE(".\script\wx\sound\shot2.wav");
			loop(36)
			{
				IceShot(angle);
				angle+=10;
			}
		}
		
		if ((count%5==0 && count%90>30 && count%90<60 && lv>1) || (count%10==0 && count%180>60 && count%180<120 && lv==1) || (count%5==0 && count%90>0 && count%90<31 && lv>3))
		{
			PlaySE(".\script\wx\sound\shot1.wav");
			let angle=getAngleToPlayer(GetX,GetY);
			SetAction(ACT_SHOT_A,5);
			loop(18)
			{
				if (lv<3) {CreateShot01(GetX+cos(angle)*50,GetY+sin(angle)*50,3,angle,AQUA02,60);}
				else {CreateShot01(GetX+cos(angle)*50,GetY+sin(angle)*50,6,angle,AQUA02,60);}
				angle+=20;
			}
		}
		if (count%300==0)
		{
			SetMovePosition02(rand(50,cx*2-50),rand(50,cy-50),30);
			SetAction(ACT_MOVE,30);
		}

		SetCollisionA(GetX(),GetY(),24);//蔻(e)o^
		SetCollisionB(GetX(),GetY(),12);//蔻(̓)o^
		}
		yield;
	}
	@DrawLoop{DrawBoss( imageBoss);}
	task IceShot(let angle)
	{
		let obj=Obj_Create(OBJ_SHOT);
		Obj_SetPosition(obj,GetX+cos(angle)*30,GetY+sin(angle)*30);
		Obj_SetAngle(obj,angle);
		if (lv<3) {Obj_SetSpeed(obj,2);} else {Obj_SetSpeed(obj,3);}
		ObjShot_SetDelay(obj,30);
		ObjShot_SetGraphic(obj,BLUE23);
		loop(90)
		{
			if (Obj_BeDeleted(obj)) {break;}
			yield;
		}
		Obj_SetSpeed(obj,0);
		Obj_SetAngle(obj,getAngleToPlayer(Obj_GetX(obj),Obj_GetY(obj)));
		loop(30)
		{
			if (Obj_BeDeleted(obj)) {break;}
			yield;
		}
		if (lv<3) {Obj_SetSpeed(obj,3);} else {Obj_SetSpeed(obj,4);}
		while(!Obj_BeDeleted(obj))
		{
			yield;
		}
		
	}
	function getAngleToPlayer(x, y)
	{
  		return atan2(GetPlayerY - y, GetPlayerX - x);
 	}	
	@Finalize
	{//ǂ݂񂾃t@C폜
		loop(16){CreateItem(ITEM_SCORE,GetX+rand(-50,50),GetY+rand(-50,50));}
	}
	
}