
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";

	@Initialize {
        	SetLife(2000);
		InitializeAction();
		LoadUserShotData(shotData);
        	LoadGraphic(imgBoss);
		Load;
        	Main;
	}
	
	@MainLoop {
        	SetCollisionA(GetX, GetY, 32);
        	SetCollisionB(GetX, GetY, 16);
		yield;
	}

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

    	task Main {
        	yield;
		SetDamageRate(100,100);
		moveA;
		shot;
	}

	task shot{
		shotA;
		shotB;
		shotC;
		shotD;
		shotE;
	}

	task shotA {
		let B=30;
		loop{
		wait(9);
		let angleA=0;
		while(angleA<360){
		CreateShot01(GetX,GetY,3,angleA-B,89,0);
		angleA+=120;
		}
		PlaySE(seShot5);
		B+=8;
		}
	}

	task shotB {
		let B=0;
		loop{
		wait(9);
		let angleA=0;
		while(angleA<360){
		CreateShot01(GetX,GetY,2.4,angleA-B,95,0);
		angleA+=120;
		}
		B+=8;
		}
	}

	task shotC {
		let B=0;
		loop{
		wait(10);
		let angleA=0;
		while(angleA<360){
		CreateShot01(GetX,GetY,2.2,angleA-B,94,0);
		angleA+=72;
		}
		B+=6;
		}
	}

	task shotD {
		let B=0;
		loop{
		wait(10);
		let angleA=0;
		while(angleA<360){
		CreateShot01(GetX,GetY,1.8,angleA-B,95,0);
		angleA+=45;
		}
		B+=7;
		}
	}

	task shotE {
		let B=0;
		loop{
		wait(12);
		let angleA=0;
		while(angleA<360){
		CreateShot01(GetX,GetY,1.2,angleA-B,89,0);
		angleA+=45;
		}
		B+=7;
		}
	}

	task moveA {
		loop{
        	wait(240);
		if(GetX<=GetPlayerX&&GetX<360||GetX<120){
			if(GetY>140){
			SetAction(ACT_MOVE,60);
			SetMovePosition02(GetX+50,GetY-30,30);
			}
			else if(GetY<100){
			SetAction(ACT_MOVE,60);
			SetMovePosition02(GetX+50,GetY+30,30);
			}
			else{
			SetAction(ACT_MOVE,60);
			SetMovePosition02(GetX+50,GetY+rand(-30,30),30);
			}
		}
		else{
			if(GetY>140){
			SetAction(ACT_MOVE,60);
			SetMovePosition02(GetX-50,GetY-30,30);
			}
			else if(GetY<100){
			SetAction(ACT_MOVE,60);
			SetMovePosition02(GetX-50,GetY+30,30);
			}
			else{
			SetAction(ACT_MOVE,60);
			SetMovePosition02(GetX-50,GetY+rand(-30,30),30);
			}
		}
		yield;
		}
	}

	@Finalize{
		DeleteGraphic(imgBoss);
		Delete;
	}

}