#e
#Title[uhSjbNV[hOv]
#Text[GH̃XyJ[h]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
        let imgBoss =csd~"img\dot_utuho.png";
        let name    = "uhSjbNV[hOv";
	let Animation=0;
        let angle = 0;
        let angleX = 0;
        let angleY = 0;
        let angleZ = 0;
	let Lock=0;
	let imgEnemy=csd~"img\CAUTION2.png";
	let imgAngle=0;

    @Initialize {
    CutIn(YOUMU, name, 0, 0, 0, 0, 0);

        SetLife(3000);
        SetTimer(50);
        SetScore(1000000);
        SetDamageRate(100,50);
        SetShotDirectionType(ABSOLUTE);

        SetInvincibility(0);
        SetMovePosition02(cx,120,60);
	LoadGraphic(imgBoss);
	LoadGraphic(imgEnemy);
        TAnime;
    }

        @MainLoop
        {
	imgAngle+=0.2;
	if(imgAngle>360){imgAngle=0;}
        if(count%30==0&&count>=60&&count<=120)
        {
		Concentration01(60);
        }
        if(count==200)
        {
        	Lock=GetAngleToPlayer;
		let Laser01=1;
		CreateLaserA(Laser01,GetEnemyX+cos(Lock)*20,GetEnemyY+sin(Lock)*20,0,250,BLUE01,75);
		SetLaserDataA(Laser01,0,Lock,0,10,0,0);
		SetLaserDataA(Laser01,25,NULL,0.2,10,0,0);
		SetLaserDataA(Laser01,75,NULL,0,0,0,0);
		SetShotKillTime(Laser01,500);
		FireShot(Laser01);
		let Laser01=1;
		CreateLaserA(Laser01,GetEnemyX+cos(Lock)*20,GetEnemyY+sin(Lock)*20,0,250,BLUE01,75);
		SetLaserDataA(Laser01,0,Lock,0,10,0,0);
		SetLaserDataA(Laser01,25,NULL,-0.2,10,0,0);
		SetLaserDataA(Laser01,75,NULL,0,0,0,0);
		SetShotKillTime(Laser01,500);
		FireShot(Laser01);
        }

        if(count>=275&&count<=575&&count%25==0)
        {
        	let angleFam   = [Lock+rand(-30,30)];
        	ascent(i in 0..1) {CreateEnemyFromScript("DOLL02",GetX,GetY,0,angleFam[i],1);}

        	let i = 0;
        	while( i < 73 )
        	{
		let id   = 0;
        	SetShotDirectionType(ABSOLUTE);
		CreateShotA(id,GetX,GetY,0);
		SetShotDataA(id,0,5,i*2.5+Lock+90,0,-0.01,1,BLUE04);
		FireShot(id);
        	i++;
		}

        	let i = 0;
        	while( i < 72 )
        	{
		let id   = 0;
        	SetShotDirectionType(ABSOLUTE);
		CreateShotA(id,GetX,GetY,0);
		SetShotDataA(id,0,4,i*2.5+Lock+91.25,0,-0.01,1,BLUE04);
		FireShot(id);
        	i++;
		}
        }
	if(count==700){
		SetMovePositionRandom01(rand(40,100),rand(40,100),2,GetClipMinX()+50,100,GetClipMaxX()-50,200);
		}
	if(count==750){
		count=150;
		}
	SetCollisionA(GetX(),GetY(),32);
        SetCollisionB(GetX(),GetY(),24);
        count++;
        yield;
        }

        @DrawLoop {
		SetGraphicRect(0,0,255,255);
		SetTexture(imgEnemy);
		SetGraphicScale(1,1);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());

		SetRenderState(ALPHA);
		SetTexture(imgBoss);
		SetGraphicScale(1,1);
		SetAlpha(255);
		if(int(GetSpeedX())==0)
		{SetGraphicRect(0,128*Animation,127,127+128*Animation);}
		else if(GetSpeedX()>0){SetGraphicRect(256,384,383,511);}
		else if(GetSpeedX()<0){SetGraphicRect(256,128,383,255);}
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
        } 
	
    	task TAnime{
		loop{
			Animation=0;
        		loop(10){yield;}
			Animation=1;
        		loop(10){yield;}
			Animation=2;
        		loop(10){yield;}
			}
		}
}

script_enemy DOLL02 {
        let count=0;
        let csd     = GetCurrentScriptDirectory;
	let angle=rand_int(0,25);
        let angleA = GetAngle;
        let angleB = 0;
        let angleC = 0;
	let r=0;
        let imgBoss =csd~"img\dot_utuho.png";

    @Initialize {
        SetLife(10);
        SetInvincibility(0);
        SetShotDirectionType(ABSOLUTE);
	SetMovePosition01(GetEnemyX+cos(angleA)*1000,GetEnemyY+sin(angleA)*1000,rand(3,6));
    }

        @MainLoop
        {
        	if(count>=40&&count%20==0)
        	{
        	TShotA;
        	}
        	if(GetX<0||GetX>448||GetY>480||GetY<0)
        	{
        		VanishEnemy();
        	}
        count++;
        yield;
        }

        @DrawLoop {
		SetGraphicRect(0,0,1,1);
		SetTexture(imgBoss);
		SetGraphicScale(1,1);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
        }

    task TShotA {
        	shotBomD;
	}
    sub shotBomD {
        	let i = 0;
        	while( i < 25 )
        	{
		let id   = 0;
        	SetShotDirectionType(ABSOLUTE);
		CreateShotA(id,GetX,GetY,0);
		SetShotDataA(id,0,rand(1,5),rand(0,360),0,rand(-0.2,-0.01),1,BLUE01);
		FireShot(id);
        	i++;
		}
	yield;
    }
}