#e
#Title[uiCgCv]
#Text[Ex[~AFuiCgCv]
#Image[.\img\ExRumia(uiCgCv).png]
#BackGround[Default]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
	let count=0;
	let cx=GetCenterX();//STGV[̒SxW擾;
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	let step=1;
	@Initialize
	{
		SetScore(50000);//XyJ[h{[iX50000ɐݒ
		SetLife(280);//Ct280ɐݒ
		SetDamageRate(10,10);//_[W10%ɐݒ
		SetTimer(60);;//Ԑ60bɐݒ

		SetGraphicRect(1,1,64,64);//`挳`ݒ
		SetInvincibility(30);//G30t[Gɂ
		LoadGraphic(imgExRumia);//摜uimg\ExRumia.pngvǂ݂		
		LoadGraphic(imgExRumiaBack);
		
		SetColor(255,64,64);
		SetMovePosition02(cx,60,60);//W(cx,60)60t[Ĉړ
		Concentration01(120);
		SetText("uiCgCv");//XyJ[h\
		CutIn(YOUMU,"uiCgCv",0,0,0,0,0);//XyJ[h\
		SetEffectForZeroLife(90,192,1);
	}
	
	@MainLoop
	{
		SetColor(255,64,64);
		if(count>90&&count<150&&count%3==0)
		{//[U[
			let tang=GetAngleToPlayer()+6;
			tang+=(count-90)*2;
			let tLaser=0;
			CreateLaserB(tLaser,700,15,RED01,90);
			SetLaserDataB(tLaser,0,0,100,0,tang,0,tang,0);
			SetLaserDataB(tLaser,20,0,100,-0.5,tang,0,tang,0);
			let i=0;
			while(i<5)
			{
				let tShot=1;
				CreateShotA(tShot,0,0,30);
				SetShotDataA(tShot,0,1.5,-90,0,0,1.5,RED21);
				AddShot(80,tLaser,tShot,i*60);
				i++;
			}
			SetShotKillTime(tLaser,255);			
			FireShot(tLaser);

			tang=GetAngleToPlayer()-6;
			tang+=-(count-90)*2;
			CreateLaserB(tLaser,700,15,RED01,90);
			SetLaserDataB(tLaser,0,0,100,0,tang,0,tang,0);
			SetLaserDataB(tLaser,20,0,100,-0.5,tang,0,tang,0);
			i=0;
			while(i<5)
			{
				let tShot=1;
				CreateShotA(tShot,0,0,30);
				SetShotDataA(tShot,0,1.5,90,0,0,1.5,RED21);
				AddShot(80,tLaser,tShot,i*60);
				i++;
			}
			SetShotKillTime(tLaser,255);
			FireShot(tLaser);
		}
		else if(count==240)
		{
			let tang=GetAngleToPlayer();
			let i=0;
			while(i<360)
			{
				CreateShot02(GetX(),GetY(),5,i,-0.2,3,RED21,30);
				i+=10;;
			}
		}
		else if(count==270)
		{//_Ɉړ߂
			Concentration01(60);
			SetMovePositionRandom01(50,20,5,GetClipMinX()+100,30,GetClipMaxX()-100,100);
		}
		else if(count==300)
		{
			count=89;
		}	
		SetCollisionA(GetX(),GetY(),32);//蔻(e)o^
		count++;
	}
	
	@Finalize
	{//ǂ݂񂾃t@C폜
		DeleteGraphic(imgExRumia);	
		DeleteGraphic(imgExRumiaBack);
	}
	
	@DrawLoop
	{
		SetColor(255,255,255);
		//Ex[~A`
		SetRenderState(ALPHA);
		SetAlpha(255);
		SetTexture(imgExRumia);
		if(int(GetSpeedX())==0){SetGraphicRect(64,1,127,64);}
		else if(GetSpeedX()>0){SetGraphicRect(192,1,255,64);}
		else if(GetSpeedX()<0){SetGraphicRect(128,1,191,64);}
		DrawGraphic(GetX(),GetY());
	}
	@BackGround
	{
		//wi`
		SetGraphicRect(0,0,384,448);
		SetTexture(imgExRumiaBack);
		DrawGraphic(cx,240);		
	}	
}