#Title[됌뎸봍쀓]
#Text[됌뎸봍쀓궻뱋뤾]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let sxy=1;
        let sp=0;
        let x=0;
        let y=0;
        let csd=GetCurrentScriptDirectory;
        let imgBoss=csd~"img\ExOrin.png";
	let shotseA=csd~"se\Powar.wav";
	let shotseB=csd~"se\ShotSE04.wav";

	@Initialize
	{
	SetLife(3000);
	SetTimer(120);
        SetDamageRate(100,100);
        SetInvincibility(200);
        SetMovePosition02(GetCenterX(),120,50);
	LoadGraphic(imgBoss);
	LoadUserShotData(csd~"img\PLUS_shot.txt");
	}
	
	@MainLoop
	{
	if(count==150){
		Concentration01(50);
		PlaySE(shotseA);
		}
	if(count>=150&&count<=200){
		sp+=5;
		sxy+=0.01;
		}
	if(count>=200&&count<=280&&count%20==0){
        	SetShotDirectionType(ABSOLUTE);
		PlaySE(shotseB);
		let i=0;
		while(i<100){
        		let shot01=1;
        		CreateShotA(shot01,GetX,GetY,0);
        		SetShotDataA(shot01,0,5,rand(0,360),0,rand(-1,-0.2),0,111);
        		SetShotDataA(shot01,100,0,NULL,0,rand(0.01,0.1),1.5,111);
        		FireShot(shot01);
			i++;
			}
		x=rand(GetClipMinX+48,GetClipMaxX-48);
		y=rand(GetClipMinY+32,GetClipMinY+258);
		SetMovePosition02(x,y,19);
		}
	if(count==280){
		PlaySE(shotseA);
		}
	if(count>=280&&count<=330){
		sp-=5;
		sxy-=0.01;
		}
	if(count>=450){
		count=149;
		}
	if(count>=330||count<=150){
		SetCollisionA(GetX,GetY,18);
		SetCollisionB(GetX,GetY,18);
		}
	if(count>=280||count<=200){
		SetEnemyMarker(true);
		} else {SetEnemyMarker(false);}
        count++;
        yield;
	}
	
        @DrawLoop {
		SetRenderState(ALPHA);
		SetTexture(imgBoss);
		SetGraphicScale(sxy,sxy);
		SetAlpha(255-sp);
		SetGraphicRect(128,0,255,127);
		DrawGraphic(GetX(),GetY());
		SetTexture(imgBoss);
		SetGraphicScale(2.51-sxy,2.51-sxy);
		SetAlpha(sp);
		if(GetSpeedX()==0){SetGraphicRect(0,256,127,382);}
		else if(GetSpeedX()<0){SetGraphicRect(0,256,127,382);}
		else if(GetSpeedX()>0){SetGraphicRect(128,256,255,382);}
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
		DeleteGraphic(imgBoss);
        }
}