
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(2700);
		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;
	}

	task shotA {
		loop{
			let B=rand(-60,60);
			let C=rand(-30,30);
			wait(10);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX+B,GetY+C,1.5,angleA,89,0);
			angleA+=10;
			}
			PlaySE(seShot5);
		}
	}

	task shotB {
		loop{
			let B=rand(-60,60);
			let C=rand(-30,30);
			wait(30);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX+B,GetY+C,3,angleA,95,0);
			angleA+=12;
			}
		}
	}

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

}