script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=150;
		
		EnemyInitialize(30);
		MoveThread;
		EnemyDrawSystem(2);
	}
	@MainLoop{EnemyMainLoopSystem(30);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard
	{
		wait(60);
		let sp=0;
		loop(2)
		{
			let p=GetAngleToPlayer;
			loop(10)
			{
				let way=3;
				let wide=80;
				
				let speed=4.5;
				let angle=p-wide/2;
				let gra=83;
				let delay=10;
				while(angle<=p+wide/2+1)
				{
					SetEnemyShot02(GetX,GetY,0,angle,speed/60,speed,gra,delay);
					angle+=wide/(way-1);
				}
				wait(3);
			}
			local
			{
				let wide=8;
				
				let speed=1.5;
				let angle=p-wide/2;
				let gra=26;
				let delay=10;
				while(angle<=p+wide/2+1)
				{
					SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
					angle+=2;
				}
			}
			wait(60);
		}
		enemyargument=1;
	}
	
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
		wait(30);
		loop(4)
		{
			local
			{
				let p=GetAngleToPlayer;
				let wide=90;
				let way=3;
				
				let speed=3.5;
				let angle=p-wide/2;
				let gra=63;
				let delay=10;
				while(angle<=p+wide/2+1)
				{
					SetShot(GetX,GetY,speed,angle,gra,delay);
					angle+=wide/(way-1);
				}
			}
			wait(40);
			task SetShot(let sx,let sy,let spd,let ag,let gra,let delay)
			{
				let speed=[spd,spd*0.7,spd*0.85];
				local
				{
					ascent(a in 0..2)
					{
						SetEnemyShot01(sx,sy,speed[a],ag,gra,delay);
					}
				}
				local
				{
					let wide=8;
					let angle=ag-wide/2;
					while(angle<=ag+wide/2+1)
					{
						SetEnemyShot01(sx,sy,speed[2],angle,gra,delay);
						angle+=wide;
					}
				}
			}
		}
		enemyargument=1;
	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited
	{
		wait(60);
		loop(2)
		{
			let p=GetAngleToPlayer;
			local
			{
				let wide=90;
				let wideB=10;
				let way=3;
				let speed=4.6;
				let gra=14;
				let delay=10;
				let ag=p-wide/2;
				while(ag<=p+wide/2+1)
				{
					let angle=ag-wideB/2;
					while(angle<=ag+wideB/2+1)
					{
						SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
						angle+=2;
					}
					ag+=wide/(way-1);
				}
			}
			local
			{
				let speed=4.5;
				let angle=p;
				let gra=62;
				let delay=10;
				while(speed>=1.5)
				{
					SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
					speed/=1.05;
				}
			}
			wait(40);
		}
		enemyargument=1;
	}
	
	
	task MoveThread
	{
		while(enemyargument==0)
		{
			SetSpeed(enemyspeed);
			if(enemyspeed>0){enemyspeed-=0.07;}
			yield;
		}
		loop
		{
			schMove(GetPlayerX,GetPlayerY,1.1);
			SetSpeed(enemyspeed);
			if(enemyspeed<6){enemyspeed+=0.025;}
			yield;
		}
	}
}