
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(2300);
		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=0;
		loop{
			wait(10);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,3,angleA-B,89,0);
			angleA+=72;
			}
			PlaySE(seShot5);
			B+=10;
		}
	}

	task shotB {
		let B=0;
		loop{
			wait(10);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,2.6,angleA-B,95,0);
			angleA+=72;
			}
			B+=10;
		}
	}

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

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

	task shotE {
		let B=0;
		loop{
			wait(30);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,1,angleA-B,89,0);
			angleA+=20;
			}
			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;
	}

}