
script_enemy_main {
	#include_function ".\lib\lib_anime_mokou.txt"
	#include_function ".\Draw.txt"
	#include_function ".\lib_Functions.txt"
	let imgBoss	=csd ~ "img\dot_mokou.png";
	let imgback	=csd~"img\back2.png";

	@Initialize {
        	SetLife(520);
		SetTimer(90);
		SetScore(1700000);
		SetDamageRate(0, 0);
		InitializeAction();
		LoadUserShotData(shotData);
		LoadGraphic(imgBoss);
		LoadGraphic(imgback);
		Load;
        	CutIn(YOUMU,"ō߁u҂̎ -- v", NULL, 0, 0, 0, 0);
        	Main;
	}

    	@MainLoop {
        	SetCollisionA(GetX, GetY, 32);
        	SetCollisionB(GetX, GetY, 16);
		if(GetTimer==10&&counter==0){
			Timer;
			counter++;
		}
        	yield;
    	}

	@DrawLoop {
		SetColor(255,255,255);
		SetGraphicScale(1,1);
		SetAlpha(255);
		DrawBoss(imgBoss);
	}

	@BackGround {
		SetColor(100,100,255);
		SetAlpha(150);
		SetTexture(imgback);
		SetGraphicRect(0, 0, 384, 457);
		SetGraphicAngle(0, 0, 0);
		DrawGraphic(224, 240);
		if(drawcount==1){
			DrawHououZ(200, 200, 100, 100);
		}
		if(drawcount>0){
			DrawHouou(200, 200, 100, 100);
			DrawIrusion(GetX, GetY,100,255,100,100);
		}
	}

	sub standBy {
		SetMovePosition03(cenX,cenY-80, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
	}

   	task Main {
        	yield;
		standBy;
		Charge;
		PlaySE(seCharge1);
		wait(30);
		drawcount++;
		wait(30);
		drawcount++;
		wait(60);
		SetDamageRate(20, 0);
		BombBarrier;
		Att;
	}

	task Att{
		let angle=GetAngleToPlayer;
		shotA(GetX-100, GetY-10,angle);
		shotA(GetX-120, GetY+30,angle-10);
		shotA(GetX+100, GetY-10,angle+30);
		shotA(GetX+120, GetY+30,angle+40);
		shotB;
		loop{
			wait(240);
			Lezar(110, -1);
			PlaySE(seLaser1);
			wait(360);
			Lezar(70, 1);
			PlaySE(seLaser1);
			wait(140);
			yield;
		}
	}

	task shotA(let x,let y,let angle){
		let D=-120;
		wait(35);
		while(D<120){
		Waveshot(x,y,angle+D);
		D+=30;
		}
		PlaySE(seShot2);
	}

	task shotB{
		loop{
			let angleA=0;
			let angle=GetAngleToPlayer;
			while(angleA<360){
			CreateShot01(GetX,GetY,1,angle+angleA,41,0);
			angleA+=20;
			}
			PlaySE(seShot5);
			wait(20);
			yield;
		}
	}

	task Lezar(let angle, let d){
		CreateLaserA(0,GetX,GetY,600,20,BLUE01,0);
		SetLaserDataA(0,1,angle,d*1,0,0,0);
		SetShotKillTime(0,120);
		FireShot(0);
	}
	
	task Waveshot(let x,let y,let angle){
		let A=0;
		loop{
			let q=0;
			while(q<360){
			CreateShot01(x,y,6,angle+3*sin(q)+30*sin(A),46,0);
			wait(2);
			q+=30;
			A+=1;
			}
		yield;
		}
	}

	@Finalize{
		DeleteGraphic(imgBoss);
		Delete;
		Spell;
	}

}