script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=40;
		
		EnemyInitialize(3);
		MoveThread;
		EnemyDrawSystem(0);
	}
	@MainLoop{EnemyMainLoopSystem(30);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard
	{
		wait(2);	
		loop(10)
		{
			let px=GetPlayerX;let py=GetPlayerY;
			let speed=2.5;
			let angle=atan2(py-GetY,px-GetX);
			let gra=81;
			let delay=5;
			SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
			wait(8);
		}
	}
	
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
		wait(2);
		let sp=0;
		loop(10)
		{
			let p=GetAngleToPlayer;
			let speed=2+sp;
			let angle=p;
			let gra=65;
			let delay=5;
			SetEnemyShot02(GetX,GetY,0,angle,speed/180,speed,gra,delay);
			wait(8);
			sp+=0.2;
		}

	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited
	{
		wait(2);
		let sp=0;
		loop(20)
		{
			let p=GetAngleToPlayer;
			let sbase=6.8;
			let spd=[sbase,sbase*1.2,sbase*1.4,sbase*1.6];
			let angle=[p,p+rand(-10,10)];
			let gra=71;
			let delay=5;
			
			let red=GetCommonDataDefault("RED",1);
			let max=1;
			if(red>5000){max=2;}
			if(red>8000){max=3;}
			if(red>9999){max=4;}
			ascent(a in 0..max)
			{
				let speed=[spd[a]-sp,1.5];
				CreateShotA(1,GetX,GetY,delay);
				SetShotDataA(1,0,speed[0],angle[0],0,-speed[0]/60,0,gra);
				SetShotDataA(1,65,NULL,angle[1],0,speed[1]/120,speed[1],gra);
				FireShot(1);
			}
			wait(4);
			sp+=0.25;
		}
	}
	
	
	task MoveThread
	{
		wait(20);
		loop(100)
		{
			schMove(cenX,minY-40,1.5);
			yield;
		}
	}
}