script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=300;
		
		EnemyInitialize(200);
		MoveThread;
		EnemyDrawSystem(3);
	}
	@MainLoop{EnemyMainLoopSystem(30);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard
	{
		wait(50);
		loop(3)
		{
			let wide=210+360;
			let p=GetAngleToPlayer;
			let s=0;
			loop(12)
			{
				let speed=1+s;
				let angle=p-wide/2;
				let gra=82;
				let delay=7;
				while(angle<=p+wide/2)
				{
					SetShot(GetX,GetY,speed,angle,gra,delay);
					angle+=wide;
				}
				wait(4);
				s+=0.5;
				wide+=25;
				
				task SetShot(let sx,let sy,let speed,let angle,let gra,let delay)
				{
					loop(14)
					{
						CreateShot01(sx,sy,speed,angle,gra,delay);
						wait(2);
					}
				}
			}
			wait(50);
		}
		enemyargument=1;
	}
	
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
		wait(50);
		loop(3)
		{
			let wide=160;
			let p=GetAngleToPlayer;
			let s=0;
			loop(20)
			{
				let speed=1.5+s;
				let angle=p-wide/2;
				let gra=111;
				let delay=7;
				while(angle<=p+wide/2)
				{
					SetShot(GetX,GetY,speed,angle,gra,delay);
					angle+=wide;
				}
				wait(1);
				s+=0.25;
				wide-=6;
				task SetShot(let sx,let sy,let speed,let angle,let gra,let delay)
				{
					loop(14)
					{
						CreateShot01(sx,sy,speed,angle,gra,delay);
						wait(2);
					}
				}
			}
			wait(40);
			let wide=2;
			let way=2;
			let s=0;
			loop(9)
			{
				let speed=3+s;
				let angle=p-wide/2;
				let gra=62;
				let delay=0;
				while(angle<=p+wide/2+1)
				{
					CreateShot01(GetX,GetY,speed,angle,gra,delay);
					angle+=wide/(way-1);
				}
				wide+=3;
				way+=1;
				s+=0.25;
				wait(2);
			}
			wait(50);
		}
		enemyargument=1;
	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited
	{
		wait(50);
		loop(3)
		{
			let p=GetAngleToPlayer;
			let gra=111;
			let delay=7;
			local
			{
				let wide=3;
				let s=0;
				loop(12)
				{
					let speed=2+s;
					let angle=p-wide/2;
					while(angle<=p+wide/2)
					{
						SetShot(GetX,GetY,speed,angle,gra,delay);
						angle+=wide;
					}
					wait(1);
					s+=0.3;
					wide+=2;
				}
			}
			local
			{
				let wide=150;
				let s=0;
				loop(20)
				{
					let speed=2+s;
					let angle=p-wide/2;
					while(angle<=p+wide/2)
					{
						SetShot(GetX,GetY,speed,angle,gra,delay);
						angle+=wide;
					}
					wait(1);
					s+=0.3;
					wide-=4;
				}
			}
			task SetShot(let sx,let sy,let speed,let angle,let gra,let delay)
			{
				loop(10)
				{
					CreateShot01(sx,sy,speed,angle,gra,delay);
					wait(2);
				}
			}
			wait(60);
		}
		enemyargument=1;
	}
	
	
	task MoveThread
	{
		while(enemyargument==0)
		{
			SetSpeed(enemyspeed);
			if(enemyspeed>0){enemyspeed-=0.07;}
			yield;
		}
		loop
		{
			SetSpeed(enemyspeed);
			if(enemyspeed<4){enemyspeed+=0.05;}
			yield;
		}
	}
}