#e
#Title[(AR)]
#Text[Ayako]
#Image[]
#Player[FREE]
#ScriptVersion[2]
#BackGround[User(.\BG\Map1\O1.png,0,3)]

script_enemy_main {
	let current = GetCurrentScriptDirectory;
	let imgAyako = current~"KanAyako.png";
	let count = 0;
	let counter = 0;
	let Moct = 0;
	let Angle = 90;
	
	@Initialize { 
		SetX(GetCenterX);
		SetY(GetCenterY-120);
		
		SetLife(5500);
		SetTimer(90); 
		SetScore(3500);
		
		LoadGraphic(imgAyako);
		SetTexture(imgAyako);
		LoadUserShotData(current~"WeaponData.txt"); 
		 
		//PlayMusic("BGM\03BossAyakoA.mp3");
	}
	
	@MainLoop { 
		SetCollisionA(GetX,GetY,12);
		SetCollisionB(GetX,GetY,12);
		
		MagicCircle(false);
		alternative(GetTimer)
		case(16,59){Concentration01(60);}
		
		if(GetTimer>60){
			if(GetPlayerY>GetY+50){
				ShotA;
				MoveA;
			}
			else if(GetPlayerY<GetY+50){
				if(count%15==0){ShotB;}
				MoveB;
			}
		}
		else if(GetTimer>17&&GetTimer<58){
			if(Moct>50&&Moct<90||Moct>160&&Moct<200||Moct>270&&Moct<310){
				if(count%10==0){ShotC;}
			}
			MoveC;
		}
		else if(GetTimer<15){
			if(count%15==0){ShotD;}
			SetMovePosition03(224,140,15,9);

		}
		
		if(count==60){count=0;}
		if(Moct==361){Moct=0;}
		yield;count++;Moct++;
	}
	
	@DrawLoop {
		SetColor( 255, 255, 255);
		SetRenderState(ALPHA);
		
		if(GetTimer>60){
			if(int(GetSpeedX)==0){SetGraphicRect(3,3,92,83);}
			else if(GetSpeedX>0||GetSpeedX<0){
			SetGraphicRect(96,3,185,83);}
		}
		else if(GetTimer>17&&GetTimer<58){
			if(int(GetSpeedX)==0){SetGraphicRect(3,87,92,167);}
			else if(GetSpeedX>0||GetSpeedX<0){SetGraphicRect(96,87,185,167);}
		}
		else{
			SetGraphicRect(96,87,185,167);
		}
		DrawGraphic(GetX,GetY);

	}
	
	@Finalize {
		DeleteGraphic(imgAyako);
		//DeleteMusic("BGM\03BossAyakoA.mp3");
	}
	task ShotA{//e
		alternative(count)
		case(3,6,9,12,15){CreateShot01(GetX-20,GetY+5,8,GetAngleToPlayer-5,25,10);}
		}
	task ShotB{//C
		let way = -25+GetAngleToPlayer;
			loop(6){
				CreateShot01(GetX+6,GetY-10,5,way,23,5);
			way+=10;
			}
		}
	task ShotC{//RAVbgA
		let way = -25+GetAngleToPlayer;
		loop(5){
			CreateShot01(GetX,GetY-4,9,way+rand(0,10),
			[14,15][rand_int(0, 1)],10);
			way+=10;
			}
		}
	task ShotD{//RAVbgB
		let way = -30+GetAngleToPlayer;
			loop(7){
				CreateShot01(GetX,GetY-4,10,way,23,5);
			way+=10;
			}
		}
	task ShotE{//ATg

		}
	task MoveA{//224,140
		alternative(Moct)
		case(60,120,180,240,300,360){SetMovePosition03(GetPlayerX+20,160,15,4);}
		yield;	
	}
	task MoveB{//224,140
		alternative(Moct)
		case(0,110,220,330){SetMovePosition03(GetPlayerX,GetPlayerY+20,15,4);}
		yield;
	}	
	task MoveC{//224,140
		alternative(Moct)
		case(0,110,220,330){SetMovePosition03(GetPlayerX,GetPlayerY,20,6);}
		yield;
	}
}