script_enemy_main{


//Argument 0 = down, 1 = up

	#include_function".\..\function\glo_enemydrop.txt";




	let ne_image = GetCurrentScriptDirectory~"..\img\enemy\devicered.png";



	let enemyframe1 = 0;
	let ne_spin = 0;





	let e_frametime = 0;
	let e_vanishframe = 440;

//-------------------------------------------------------------------------------------------------
// Any Task







//--------------------------------------------------------------------------------------------------------------

    @Initialize
	{
	SetLife(45);
	SetDamageRate(0,0);
	SetInvincibility(10);
	LoadGraphic(ne_image);

	SetMovePosition02(GetX, GetY, 0);
	}

//--------------------------------------------------------------------------------------------------------------

    @MainLoop
	{
	SetDamageRate(70+(6*GetCommonDataDefault("CD_PowerUse",0)),35+(3*GetCommonDataDefault("CD_PowerUse",0)));

	SetCollisionA(GetX, GetY, 32);
	if ((GetPlayerType == REIMU_A) || (GetPlayerType == REIMU_B))
	{	SetCollisionB(GetX, GetY, 0);	}	else
	{	SetCollisionB(GetX, GetY, 16);	}

	SetShotDirectionType(ABSOLUTE);

//----------------------
// Attack script below
//----------------------


	if (enemyframe1 == 0)
	{
	SetMovePositionHermite(GetCenterX, 100, 600, 180-(GetArgument*180), 600, 0+(GetArgument*180), 90);
	}

	if (enemyframe1 == 90)
	{
	SetMovePositionHermite(GetCenterX, 200, 600, 0+(GetArgument*180), 600, 180-(GetArgument*180), 90);
	}

	if (enemyframe1 == 180)
	{
	SetMovePositionHermite(GetCenterX, 300, 600, 180-(GetArgument*180), 600, 0+(GetArgument*180), 90);
	}

	if (enemyframe1 == 270)
	{
	SetMovePositionHermite(GetCenterX, 400, 600, 0+(GetArgument*180), 600, 180-(GetArgument*180), 90);
	}

	if (enemyframe1 == 360)
	{
	SetMovePositionHermite(GetCenterX, 500, 600, 180-(GetArgument*180), 600, 0+(GetArgument*180), 90);
	}

	if ((enemyframe1%45 == 0) && (enemyframe1 > 0) && (enemyframe1%90 != 0))
	{
	PlaySE(GetCurrentScriptDirectory~"..\sfx\Shot1.wav");
	if (GetArgument == 1)
		{
		if (GetCommonData("CD_gamemode") == 2)
			{
			ascent (i in 0..5)
				{
				CreateShotA(i, GetX, GetY, 10);
				SetShotDataA(i, 0, 0, GetAngleToPlayer-3+i, 0, 0, 0, BLUE01);
				SetShotDataA(i, 30, 0, GetAngleToPlayer-3+i, 0, 0.1, 4, BLUE01);
				FireShot(i);
				}
			}
		else
			{
			CreateShotA(0, GetX, GetY, 10);
			SetShotDataA(0, 0, 0, GetAngleToPlayer, 0, 0, 0, BLUE01);
			SetShotDataA(0, 30, 0, GetAngleToPlayer, 0, 0.1, 4, BLUE01);
			FireShot(0);
			}
		}
	else
		{
		if (GetCommonData("CD_gamemode") == 2)
			{
			ascent (i in 0..5)
				{
				CreateShotA(i, GetX, GetY, 10);
				SetShotDataA(i, 0, 0, GetAngleToPlayer-3+i, 0, 0, 0, RED01);
				SetShotDataA(i, 30, 0, GetAngleToPlayer-3+i, 0, 0.1, 4, RED01);
				FireShot(i);
				}
			}
		else
			{
			CreateShotA(0, GetX, GetY, 10);
			SetShotDataA(0, 0, 0, GetAngleToPlayer, 0, 0, 0, RED01);
			SetShotDataA(0, 30, 0, GetAngleToPlayer, 0, 0.1, 4, RED01);
			FireShot(0);
			}
		}
	}










	enemyframe1++;



//----------------------
// Attack script above
//----------------------

	if ((e_frametime >= e_vanishframe) || (GetX < GetClipMinX-50) || (GetX > GetClipMaxX+50)
	 || (GetY < GetClipMinY-50) || (GetY > GetClipMaxY+50))
		{
		VanishEnemy;
		}

	e_frametime++;
	}




//--------------------------------------------------------------------------------------------------------------

    @Finalize
	{
	if ((BeVanished == false) && (OnBomb == false))
		{
		if (GetArgument == 1)	{	EnemyDropItem(1, 1);	}
		else {	EnemyDropItem(3, 1);	}
		SetCommonData("CD_Feverscore", GetCommonDataDefault("CD_Feverscore",0) + 500);
		}
	AddScore(2500 * GetCommonDataDefault("CD_FeverMultiplyUse",1) * GetCommonDataDefault("CD_gamemode",1));
	}

//--------------------------------------------------------------------------------------------------------------

    @DrawLoop
	{
	SetTexture(ne_image);
	SetGraphicRect(0, 0, 31, 31);
	SetColor(255, 255, 255);
	SetRenderState(ALPHA);
	SetGraphicAngle(0, 0, ne_spin);
	DrawGraphic(GetX, GetY);
	ne_spin += 3;
	}
}