script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=80;
		
		EnemyInitialize(25);
		MoveThread;
		EnemyDrawSystem(2);
	}
	@MainLoop{EnemyMainLoopSystem(30);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard
	{
		wait(30);
		let sp=0;
		loop(3)
		{
			loop(4)
			{
				let wide=0.6;
				let p=GetAngleToPlayer;
				let angle=p;
				let speed=2.4+sp;
				let gra=81;
				let delay=5;
				
				SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
				speed/=1.01;
				angle=p-wide/2;
				while(angle<=p+wide/2+0.1)
				{
					CreateShot01(GetX,GetY,speed,angle,gra,delay);
					angle+=wide;
				}
				wait(10);
				sp+=0.08;
			}
			wait(60);
		}
		enemyargument=1;
	}
	
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
		wait(30);
		loop(7)
		{
			let wide=0.5;
			let cat=9;
			let p=round(GetAngleToPlayer/cat)*cat;
			let angle=p;
			let speed=1.5;
			let gra=86;
			let delay=5;
			
			SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
			speed/=1.01;
			angle=p-wide/2;
			while(angle<=p+wide/2+0.1)
			{
				SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
				angle+=wide;
			}
			wait(20);
		}
		enemyargument=1;
	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited
	{
		wait(60);
		let sp=0;
		loop(4)
		{
			let p=GetAngleToPlayer;
			let i=0;
			loop(10)
			{
				let angle=[p+rand(-i,i),p];
				let speed=[2+sp,5+sp];
				let gra=81;
				let delay=5;
				ascent(a in 0..length(speed))
				{
					SetEnemyShot01(GetX,GetY,speed[a],angle[a],gra,delay);
				}
				wait(2);
				i+=2;
			}
			sp+=0.4;
			wait(40);
		}
		enemyargument=1;
	}
	
	
	task MoveThread
	{
		while(enemyargument==0)
		{
			SetSpeed(enemyspeed);
			if(enemyspeed>0){enemyspeed-=0.07;}
			yield;
		}
		loop
		{
			schMove(cenX,minY-90,1.1);
			SetSpeed(enemyspeed);
			if(enemyspeed<1.5){enemyspeed+=0.025;}
			yield;
		}
	}
}