#e
#Title[Ŕ(JN)]
#Text[Kaga]
#Image[.\..\img\Select\Select02.png]
#Player[FREE]
#ScriptVersion[2]
#BackGround[User(.\..\BG\Map1\O4.png,0,-2)]

script_enemy_main {
	let csd = GetCurrentScriptDirectory;
	let Img = [
		csd~"..\img\Kaga.png",
		csd~"..\img\System.png",
		];
	let count = 0;
	let Moct = 0;
	let nx=68;
	let ny=107;
	
	let vg = -20;
		
	@Initialize{
		SetX(GetCenterX);
		SetY(GetCenterY-120);
		
		SetLife(4000);
		SetDamageRate(100,100);
		SetTimer(90);
		SetScore(3500);
		
		LoadData;
		ShotData;
		PlayMusic(BGM[1]);
	}
	
	@MainLoop {
		SetCollisionA(GetX,GetY,20);
		SetCollisionB(GetX,GetY,20);
		MagicCircle(false);
		
		alternative(Moct)
		case(80,100,120){ShotA;}
		case(550,562,574,586,598){ShotB;}
		
		if(Moct>160&&Moct<245||Moct>450&&Moct<540){
			if(count%15==0){ShotC;}}
		if(Moct>255&&Moct<465||Moct>650&&Moct<740){
			if(count%5==0){ShotD;}}
		Move;
		if(Moct==750){Moct=0;}
		count++;Moct++;
		yield;
	}
	
	@DrawLoop {
		if((Moct>255&&Moct<460)||(Moct>650&&Moct<740)){
		BossImg(x[1],y[0],x[2],y[1]);}
		else if(int(GetSpeedX)==0){BossImg(x[0],y[0],x[1],y[1]);}
		else if(GetSpeedX>0){BossImg(x[1],y[1],x[2],y[2]);}
		else if(GetSpeedX<0){BossImg(x[0],y[1],x[1],y[2]);}
		LifeDraw(4000);
		yield;
	}
	
	@Finalize {
		DeleteData;
	}
	task ShotA{//(dA)41 3
		CreateShotA(1,GetX+16,GetY,10);
		SetShotDataA(1, 0,6,GetAngleToPlayer,0,0,0,41);
		SetShotDataA(1, 20,4,GetAngleToPlayer,0,0,0,3);
		FireShot(1);
	}
		
	task ShotB{//(dB)51 3
		CreateShotA(1,GetX+16,GetY,10);
		SetShotDataA(1,0,4,90,rand(-0.5,0.5),0,0,51);
			let way =-15;
		loop(4){
			CreateShotA(2,0,0,10);//4way
			SetShotDataA(2, 30,3,way+GetAngleToPlayer,rand(-0.5,0.5),0,0,3);
			AddShot(25,1,2,0);
			SetShotKillTime(1,26);
			way+=15;	
			}
		FireShot(1);
	}
		
	task ShotC{//C
		let sg =-2;
		let sa = 0;
		loop(5){
			CreateShot01(GetX+10,GetY-sg,4, 90+sa,11,5);
			CreateShot01(GetX+20,GetY-sg,4, 90-sa,11,5);
			sg+=10;
			sa+=10;
			}
	}
	
	task ShotD{//C
		CreateShot01(GetX+10,GetY+vg,rand(7,10), 90+vg*rand(2,3),11,5);
		CreateShot01(GetX+20,GetY+vg,rand(7,10), 90-vg*rand(2,3),11,5);
		vg+=10;
		if(vg==30){vg= -20;}
	}
	
	task ShotE{//

	}
	
	task Move{//224,140
		alternative(Moct)
		case( 90){SetMovePosition03(124,120,15,4);}
		case(180){SetMovePosition03(324,120,15,4);}
		case(270,650){SetMovePosition03(224,240,15,4);}
		case(470){SetMovePosition03(324,100,15,4);}
		case(560){SetMovePosition03(124,100,15,4);}
	yield;	
	}
#include_function ".\..\txt\ImageObj.txt"
#include_function ".\..\txt\LoadData.txt"
#include_function ".\..\txt\System.txt"
#include_function ".\..\txt\MusicData.txt"
}