#e
#Title[yubhGNvXv]
#Text[]
#ScriptVersion[2]
script_enemy_main
{
	let count=0;
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SyW擾
	let doll=0;
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(600);
		SetDamageRate(10,10);
		SetMovePosition02(cx,cy-120,60);
		SetTimer(60);
		SetGraphicRect(1,1,64,64);
		SetInvincibility(180);
		LoadGraphic(imgExRumia);
		LoadGraphic(GetCurrentScriptDirectory~".\img\ma.png");
		SetTexture(imgExRumia);	
		shottask;
		CutIn(YOUMU,"yubhGNvXv",0,0,0,0,0);//XyJ[h\
	}
	@MainLoop
	{
		yield;
		SetCollisionA(GetX(),GetY(),24);//蔻(e)o^
		SetCollisionB(GetX(),GetY(),24);//蔻(̓)o^
	}
	@Finalize
	{
		loop(8)
		{
			CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
		}
	}
	@DrawLoop
	{
		SetGraphicRect(1,1,64,64);
		SetAlpha(255);
		DrawGraphic(GetX(),GetY());
	}
	task shottask
	{
		let a=0;
		wait(120);
		loop(8)
		{
			CreateEnemyFromScript("family",GetX,GetY,1.5,GetAngleToPlayer,a);	
			a+=45;
		}
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}
script_enemy family
{
	let angle=0;
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetLife(1);
		SetDamageRate(0,0);
		SetInvincibility(60);
		SetTexture(GetCurrentScriptDirectory~".\img\ma.png");
		shottask;
		movetask;
	}
	@MainLoop
	{
		yield;
	}
	@Finalize
	{
	}
	@DrawLoop
	{
		SetGraphicAngle(0,0,angle);
		SetGraphicRect(0,0,64,64);
		SetAlpha(255);
		DrawGraphic(GetX(),GetY());
		angle++;
	}
	task shottask
	{
		let s=0;
		let angle=atan2(GetEnemyY-GetY,GetEnemyX-GetX);
		wait(2);
		loop
		{
			angle=atan2(GetEnemyY-GetY,GetEnemyX-GetX);
			CreateShot02(GetX,GetY,0,angle,0.1,2,9,0);
			angle-=90;
			CreateShot02(GetX,GetY,0,angle,0.1,2,12,0);
			angle-=90;
			CreateShot02(GetX,GetY,0,angle,0.1,2,11,0);
			angle-=90;
			CreateShot02(GetX,GetY,0,angle,0.1,2,14,0);
			angle-=90;
			wait(9);
		}
	}
	task movetask
	{
		let r=0;
		let angle=GetArgument;
		let angle2=0;
		loop
		{
			SetX(GetEnemyX+r*cos(angle));
			SetY(GetEnemyY+r*sin(angle));
			angle+=3*sin(angle2);
			angle2++;
			if(r<120)
			{
				r++;
			}
			yield;
		}
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}