#e
#Title[ǕuА_l̎v]
#Text[]
#ScriptVersion[2]

script_enemy_main
{//Enemy01
	let count=0;
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SyW擾
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(500);
		SetDamageRate(10,5);
		SetTimer(90);
	
		SetGraphicRect(1,1,64,64);
		SetInvincibility(300);
		
		LoadGraphic(imgExRumia);	
		LoadGraphic(imgExRumiaBack);

		SetMovePosition02(cx,120,60);
		Concentration01(60);
		CutIn(YOUMU,"ǕuА_l̎v",0,0,0,0,0);//XyJ[h\
	}
	@MainLoop
	{
		let s=0;
		let angle=rand(0,360);
		let base =GetAngleToPlayer;
		function shot(let shotid,let shotx,let shoty)
		{
			CreateShotA(shotid,shotx,shoty,0);
			SetShotDirectionType(ABSOLUTE);
			SetShotDataA(shotid,0,1,270,0,0,0,112);
			FireShot(shotid);
		}
		if(count>=1)
		{
			if(count%180==130)
			{
				Concentration01(60);
			}
			if(count%180==0)
			{
				function ShotObject(let x, let y, let speed, let angle, let grf, let delay)
				{
					let obj = Obj_Create(OBJ_SHOT);
					Obj_SetX(obj, x);
					Obj_SetY(obj, y);
					Obj_SetSpeed(obj, speed);
					Obj_SetAngle(obj, angle);
					ObjShot_SetGraphic(obj, grf);
					ObjShot_SetDelay(obj, delay);
					while( !Obj_BeDeleted(obj) )
					{	
						Obj_SetY(obj, Obj_GetY(obj)-1);	
					}			
				}
				loop(90)
				{
					ShotObject(GetX,GetY,2,angle,1,0);
					angle+=4;
				}
			}
			if(count%6==0)
			{
				shot(s,rand(GetClipMinX,GetClipMaxX),GetClipMaxY);
			}
				SetPlayerY(GetPlayerY-1);
			SetCollisionA(GetX(),GetY(),24);//蔻(e)o^
			SetCollisionB(GetX(),GetY(),24);//蔻(̓)o^

		}
	count++;

	}
	@Finalize
	{//ǂ݂񂾃t@C폜
		loop(8)
		{
			CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
		}
	}
	
	@DrawLoop
	{
		//Ex[~A`
		if(count<270){SetGraphicRect(64,64,127,127)};
		if(count>=270){SetGraphicRect(1,1,64,64);}
		SetAlpha(255);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());
	}
}