script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=400;
		
		EnemyInitialize(170);
		MoveThread;
		EnemyDrawSystem(1);
	}
	@MainLoop{EnemyMainLoopSystem(30);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard
	{
		wait(80);	
		let r=1;
		if(GetX<cenX){r=-r;}
		let i=0;
		let p=GetAngleToPlayer+180;
		loop(30)
		{
			let way=5;
			let speed=[3,2];
			let angle=p;
			let ag=[i,-i];
			let gra=[110,109];
			let delay=10;
			while(angle<p+360)
			{
				ascent(a in 0..2)
				{
					let sx=GetX+15*cos(angle+ag[a]);
					let sy=GetY+15*sin(angle+ag[a]);
					SetEnemyShot01(sx,sy,speed[a],angle+ag[a],gra[a],delay);
				}
				angle+=360/way;
			}
			i+=0.5*r;
			wait(3);
		}
		enemyargument=1;
	}
	
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
		wait(80);
		let r=1;
		if(GetX<cenX){r=-r;}
		let i=0;
		let ip=1;
		let s=0;
		let p=GetAngleToPlayer;
		loop(80)
		{
			let way=2;
			let speed=[1.5+s,2+s/2];
			let angle=p;
			let ag=[i,i*1.5];
			let gra=[87,63];
			let delay=10;
			while(angle<p+360)
			{
				ascent(a in 0..1)
				{
					let sx=GetX+15*cos(angle+ag[a]);
					let sy=GetY+15*sin(angle+ag[a]);
					SetEnemyShot01(sx,sy,speed[a],angle+ag[a],gra[a],delay);
				}
				angle+=360/way;
			}
			i+=ip*r;
			ip+=0.15;
			s+=0.025;
			wait(3);
		}
		enemyargument=1;
	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited
	{
		wait(60);
		loop(4)
		{
			let p=GetAngleToPlayer;
			loop(5)
			{
				let way=60;
				let leng=30;
				let speed=2.5;
				let angle=p;
				let gra=111;
				let delay=6;
				while(angle<p+360)
				{
					let sx=GetX+(leng*2)*cos(angle);
					let sy=GetY+(leng/2)*sin(angle);
					
					SetEnemyShot02(sx,sy,0,angle,speed/100,speed,gra,delay);
					angle+=360/way;
				}
				wait(1);
			}
			wait(50);
		}
		enemyargument=1;

	}
	
	
	task MoveThread
	{
		while(enemyargument==0)
		{
			SetSpeed(enemyspeed);
			if(enemyspeed>0){enemyspeed-=0.05;}
			yield;
		}
		loop
		{
			SetSpeed(enemyspeed);
			if(enemyspeed<4){enemyspeed+=0.05;}
			yield;
		}
	}
}