script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=150;
		
		EnemyInitialize(25);
		MoveThread;
		EnemyDrawSystem(2);
	}
	@MainLoop{EnemyMainLoopSystem(30);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard
	{
		wait(30);
		loop(2)
		{
			let p=GetAngleToPlayer;
			let wide=10;
			let way=3;
			
			let speed=3;
			let gra=82;
			let delay=10;
			while(speed>=2.2)
			{
				let angle=p-wide/2;
				while(angle<=p+wide/2+1)
				{
					SetEnemyShot01(GetX,GetY,speed,angle,gra,delay);
					angle+=wide/(way-1);
				}
				speed/=1.08;
			}
			wait(50);
		}
		enemyargument=1;
	}
	
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
		wait(45);
		let way=5;
		loop(2)
		{
			let p=GetAngleToPlayer;
			let wide=150;
			loop(5)
			{
				let speed=[4,1.5];
				let gra=82;
				let delay=10;
				ascent(a in 0..length(speed))
				{
					let angle=p-wide/2;
					while(angle<=p+wide/2+1)
					{
						SetEnemyShot01(GetX,GetY,speed[a],angle,gra,delay);
						angle+=wide/(way-1);
					}
				}
				wait(3);
			}
			way++;
			wait(50);
		}
		enemyargument=1;
	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited
	{
		wait(60);
		let p=GetAngleToPlayer;
		loop(25)
		{
			let ex=[GetX-30,GetX+30];
			ascent(a in 0..2)
			{
				SetShot(ex[a]);
			}
			
			task SetShot(let ex)
			{
				let sx=[ex-5,ex+5];
				ascent(a in 0..2)
				{
					let speed=5;
					let angle=p;
					let gra=86;
					let delay=10;
					SetEnemyShot01(sx[a],GetY,speed,angle,gra,delay);
				}
			}
			wait(2);
		}
		enemyargument=1;
		loop(4)
		{
			let sx=[GetX-30,GetX+30];
			ascent(a in 0..2)
			{
				let p=atan2(GetPlayerY-GetY,GetPlayerX-sx[a]);
				let wide=18;
				
				let speed=3;
				let angle=p-wide/2;
				let gra=30;
				let delay=5;
				while(angle<=p+wide/2+1)
				{
					SetEnemyShot02(sx[a],GetY,0,angle,speed/60,speed,gra,delay);
					angle+=3;
				}
			}
			wait(12);
		}
	}
	
	
	task MoveThread
	{
		while(enemyargument==0)
		{
			SetSpeed(enemyspeed);
			if(enemyspeed>0){enemyspeed-=0.07;}
			yield;
		}
		let count=0;
		loop
		{
			schMove(cenX,minY-120,1.1);
			SetSpeed(enemyspeed);
			if(enemyspeed<5.5){enemyspeed+=0.025;}
			count++;
			yield;
		}
	}
}