script_enemy_main
{
	let sapz = GetCurrentScriptDirectory ~ "img\suiy.png";
	let sapzlol = GetCurrentScriptDirectory ~ "img\suiyz.png";
	
	let frame = 0;
	
	@Initialize
	{
		LoadUserShotData(GetCurrentScriptDirectory ~ "supershot\supershot.txt");
		
		LoadGraphic(sapz);
		LoadGraphic(sapzlol);
		
		SetLife(1500);
		SetScore(3000000);
		SetInvincibility(60);
		MagicCircle(false);
		SetRateScoreSystemEnable(false);
		SetEnemyMarker(true);
		PlayMusic(GetCurrentScriptDirectory ~ "bgm\bees.mp3");
		SetMovePosition02(GetCenterX, GetCenterY - 120, 10);
		
		summonbees;
	}

	@MainLoop
	{
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		Bombimmunity;
		if(frame==60){pew;}
		if(GetPlayerLife==1){VanishEnemy;}
		
		frame++;
		yield;
	}
	
	@DrawLoop
	{
		if(OnBomb)
		{
			SetTexture(sapzlol);
			SetGraphicRect(0, 0, 500, 500);
			SetGraphicAngle(0, 0, frame*10);
			SetGraphicScale(0.25, 0.25);
			DrawGraphic(GetX, GetY);
		}
		else
		{
			SetTexture(sapz);
			SetGraphicRect(0, 0, 250, 250);
			SetGraphicAngle(0, 0, 0);
			SetGraphicScale(0.5, 0.5);
			DrawGraphic(GetX, GetY);
		}
	}

	@Finalize
	{
	}

	function Wait(frames){loop(frames){yield;}}
	
	sub Bombimmunity
	{
		if(OnBomb)
		{
			SetDamageRate(0,0);
		}
		else
		{
			SetDamageRate(100, 0);
		}
	}
	
	sub pew
	{
		
		laserlock;
		bulletlock;
		movement;
	}
	
	task summonbees
	{
		CreateEnemyFromFile(GetCurrentScriptDirectory~"bee1.txt", GetX, GetY, 0, 0, 0);
		CreateEnemyFromFile(GetCurrentScriptDirectory~"bee1.txt", GetX, GetY, 0, 0, 60);
		CreateEnemyFromFile(GetCurrentScriptDirectory~"bee1.txt", GetX, GetY, 0, 0, 120);
		CreateEnemyFromFile(GetCurrentScriptDirectory~"bee1.txt", GetX, GetY, 0, 0, 180);
		CreateEnemyFromFile(GetCurrentScriptDirectory~"bee1.txt", GetX, GetY, 0, 0, 240);
		CreateEnemyFromFile(GetCurrentScriptDirectory~"bee1.txt", GetX, GetY, 0, 0, 300);
	}
	
	task laserlock
	{
		ascent(i in -4..-1)
		{
			CreateLaserA(0, GetCenterX-i*40+20, 484, 100, 10, 3, 30);
			SetLaserDataA(0, 0, 270, 0, 12, 0, 0);
			SetLaserDataA(0, 60, 270, 0, 0, 0, 0);
			FireShot(0);
		}
		ascent(i in 3..6)
		{
			CreateLaserA(0, GetCenterX-i*40+20, 484, 100, 10, 3, 30);
			SetLaserDataA(0, 0, 270, 0, 12, 0, 0);
			SetLaserDataA(0, 60, 270, 0, 0, 0, 0);
			FireShot(0);
		}
	}
	
	task bulletlock
	{
		CreateShot01(GetCenterX-60, 465, 1, 270, 242, rand(25,30));
		CreateShot01(GetCenterX-20, 465, 1, 270, 242, rand(25,27));
		CreateShot01(GetCenterX+20, 465, 1, 270, 242, rand(25,27));
		CreateShot01(GetCenterX+60, 465, 1, 270, 242, rand(25,30));
		Wait(rand(30,40));
		bulletlock;
	}
	
	task movement
	{
		Wait(120);
		SetMovePositionRandom01(rand(10,30), rand(10,20), rand(0.5,1.5), 175, 120, 273, GetCenterY-70);
		movement;
	}
	
}