
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(0,0);
		standBy;
		PlaySE(seCharge1);
		Charge;
		wait(60);
		SetDamageRate(100,100);
		moveA;
		shot;
	}

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

	sub standBy {
		SetMovePosition03(224, 140, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
	}

	task shotA {
		let B=60;
		loop{
			wait(4);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,2.2,angleA+B-28,94,0);
			angleA+=120;
			}
		PlaySE(seShot5);
		B+=7;
		yield;
		}
	}

	task shotB {
		let B=60;
		wait(4);
		loop{
			wait(4);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,2,angleA+B-21,95,0);
			angleA+=120;
			}
			B+=7;
			yield;
		}
	}

	task shotC {
		let B=60;
		wait(8);
		loop{
			wait(4);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,1.8,angleA+B-14,89,0);
			angleA+=120;
			}
			B+=7;
			yield;
		}
	}

	task shotD {
		let B=60;
		wait(12);
		loop{
			wait(4);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,1.6,angleA+B-7,95,0);
			angleA+=120;
			}
			B+=7;
			yield;
		}
	}

	task shotE {
		let B=60;
		wait(16);
		loop{
			wait(4);
			let angleA=0;
			while(angleA<360){
			CreateShot01(GetX,GetY,1.4,angleA+B,94,0);
			angleA+=120;
			}
			B+=7;
			yield;
		}
	}

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

}