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

	@MainLoop
	{
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		Bombimmunity;
		if(frame==20){pew;}
		if(frame>20)
		{
			SetMovePosition02(GetCenterX + (5*cos(move/2)), GetCenterY-120 + (5*sin(move)), 0);
			move+=2;
		}
		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
	{
		bluewave1;
		purplewave;
	}
	
	task bluewave1
	{
		ascent(j in 0..30)
		{
			ascent(i in 0..4)
			{
				CreateShot02(GetX+60*cos(i*360/4+j*3), GetY+60*sin(i*360/4+j*3), 6, i*360/4+j*3, -0.02, 5, 152, 10);
			}
			Wait(4);
		}
		ascent(j in 30..60)
		{
			ascent(i in 0..8)
			{
				CreateShot02(GetX+60*cos(i*360/8-j*3), GetY+60*sin(i*360/8-j*3), 6, i*360/8-j*3, -0.02, 5, 152, 10);
			}
			Wait(4);
		}
		ascent(j in 60..90)
		{
			ascent(i in 0..16)
			{
				CreateShot02(GetX+60*cos(i*360/16+j*3), GetY+60*sin(i*360/16+j*3), 6, i*360/16+j*3, -0.02, 5, 152, 10);
			}
			Wait(4);
		}
		loop
		{
			ascent(j in 90..450)
			{
				ascent(i in 0..32)
				{
					CreateShot02(GetX+60*cos(i*360/32-j*5), GetY+60*sin(i*360/32-j*5), 6, i*360/32-j*5, -0.02, 5, 152, 10);
				}
				Wait(4);
			}
		}
	}
	
	
	task purplewave
	{
		ascent(j in 0..24)
		{
			ascent(i in 0..4)
			{
				CreateShot02(GetX+10*cos(i*360/4-j*5), GetY+10*sin(i*360/4-j*5), 6, i*360/4-j*5, -0.02, 6, 42, 10);
			}
			Wait(5);
		}
		ascent(j in 24..48)
		{
			ascent(i in 0..8)
			{
				CreateShot02(GetX+10*cos(i*360/8+j*5), GetY+10*sin(i*360/8+j*5), 6, i*360/8+j*5, -0.02, 6, 42, 10);
			}
			Wait(5);
		}
		ascent(j in 48..72)
		{
			ascent(i in 0..16)
			{
				CreateShot02(GetX+10*cos(i*360/16-j*5), GetY+10*sin(i*360/16-j*5), 6, i*360/16-j*5, -0.02, 6, 42, 10);
			}
			Wait(5);
		}
		loop
		{
			ascent(j in 72..1000)
			{
				ascent(i in 0..32)
				{
					CreateShot02(GetX+10*cos(i*360/32+j*5), GetY+10*sin(i*360/32+j*5), 6, i*360/32+j*5, -0.02, 6, 42, 10);
				}
				Wait(5);
			}
		}
	}

}