script_enemy_main{


//	Argument 
//	0 = Down
//	1 = Left
//	2 = Right

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




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










	let e_frametime = 0;
	let e_vanishframe = 120;

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







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

    @Initialize
	{
	SetLife(30);
	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 (e_frametime == 1)
	{
	if (GetArgument == 0)	{	SetMovePosition02(GetX, GetClipMaxY+60, 90);	}
	else if (GetArgument == 1)	{	SetMovePosition02(GetClipMaxX+60, GetY, 90);	}
	else	{	SetMovePosition02(GetClipMinX-60, GetY, 90);	}
	}



	if (e_frametime == 20)
	{
	PlaySE(GetCurrentScriptDirectory~"..\sfx\Shot1.wav");
	if (GetCommonData("CD_gamemode") == 2)
		{
		CreateShot02(GetX, GetY, 0, GetAngleToPlayer, 0.25, 4.5, BLUE21, 5);
		CreateShot02(GetX, GetY, 0, GetAngleToPlayer+160, 0.05, 4.5, BLUE21, 5);
		CreateShot02(GetX, GetY, 0, GetAngleToPlayer+180, 0.05, 4.5, BLUE21, 5);
		CreateShot02(GetX, GetY, 0, GetAngleToPlayer+200, 0.05, 4.5, BLUE21, 5);
		}
	else
		{
		CreateShotA(1, GetX, GetY, 5);
		SetShotDataA(1, 0, 0, GetAngleToPlayer, 0, 0.25, 2.5, BLUE21);
		SetShotDataA(1, 10, 0, GetAngleToPlayer, 0, 0, 0, BLUE21);
		SetShotDataA(1, 30, 0, GetAngleToPlayer, 0, 0.25, 5, BLUE21);
		FireShot(1);
		CreateShotA(1, GetX, GetY, 5);
		SetShotDataA(1, 0, 0, GetAngleToPlayer+160, 0, 0.25, 2.5, BLUE21);
		SetShotDataA(1, 10, 0, GetAngleToPlayer+160, 0, 0, 0, BLUE21);
		SetShotDataA(1, 30, 0, GetAngleToPlayer+160, 0, 0.25, 5, BLUE21);
		FireShot(1);
		CreateShotA(1, GetX, GetY, 5);
		SetShotDataA(1, 0, 0, GetAngleToPlayer+180, 0, 0.25, 2.5, BLUE21);
		SetShotDataA(1, 10, 0, GetAngleToPlayer+180, 0, 0, 0, BLUE21);
		SetShotDataA(1, 30, 0, GetAngleToPlayer+180, 0, 0.25, 5, BLUE21);
		FireShot(1);
		CreateShotA(1, GetX, GetY, 5);
		SetShotDataA(1, 0, 0, GetAngleToPlayer+200, 0, 0.25, 2.5, BLUE21);
		SetShotDataA(1, 10, 0, GetAngleToPlayer+200, 0, 0, 0, BLUE21);
		SetShotDataA(1, 30, 0, GetAngleToPlayer+200, 0, 0.25, 5, BLUE21);
		FireShot(1);
		}
	}








//----------------------
// 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))
		{
		EnemyDropItem(1, 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, 30, 30);
	SetColor(255, 255, 255);
	SetRenderState(ALPHA);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
}