script_enemy_main{


//	Argument 0 : Left -> Right
//	Argument else : Right -> Left

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




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





	let enemyframe1 = 0;





	let e_frametime = 0;
	let e_vanishframe = 600;



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







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

    @Initialize
	{
	SetLife(350);
	SetDamageRate(0,0);
	SetInvincibility(20);
	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);
	SetCollisionB(GetX, GetY, 16);

	SetShotDirectionType(ABSOLUTE);

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

	if (e_frametime == 1)
	{
	SetMovePosition02(GetX, GetClipMinY +100, 40);
	}



if (GetCommonData("CD_gamemode") == 2)
{
	if (enemyframe1 == 40)
	{
	PlaySE(GetCurrentScriptDirectory~"..\sfx\Shot1.wav");
	ascent (i in 0..40)
		{
		CreateShotA(0, GetX, GetY, 10);
		SetShotDataA(0, 0, 0, i*9, 0, 0.5, 3, RED01);
		SetShotDataA(0, 30, 0, i*9, 0, 0, 0, RED01);
		SetShotDataA(0, 60, 0, SetShotDirectionType(PLAYER), 0, 0.1, 4, RED21);
		FireShot(0);
		SetShotDirectionType(ABSOLUTE);
		}
	}

	if (enemyframe1 == 90)
	{
	PlaySE(GetCurrentScriptDirectory~"..\sfx\BulletWave.wav");
	if (e_frametime < 480) {	enemyframe1 = 0;	}
	}

}
else
{

	if (enemyframe1 == 60)
	{
	PlaySE(GetCurrentScriptDirectory~"..\sfx\Shot1.wav");
	ascent (i in 0..20)
		{
		CreateShotA(0, GetX, GetY, 10);
		SetShotDataA(0, 0, 0, i*18, 0, 0.5, 3, RED01);
		SetShotDataA(0, 30, 0, i*18, 0, 0, 0, RED01);
		SetShotDataA(0, 60, 0, SetShotDirectionType(PLAYER), 0, 0.05, 3, RED21);
		FireShot(0);
		SetShotDirectionType(ABSOLUTE);
		}
	}

	if (enemyframe1 == 120)
	{
	PlaySE(GetCurrentScriptDirectory~"..\sfx\BulletWave.wav");
	if (e_frametime < 450) {	enemyframe1 = 0;	}
	}

}





	if (e_frametime == 510)
	{
	SetMovePosition02(GetX, GetClipMinY -60, 90);
	}



	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))
		{
		EnemyDropItem(1, 5);
		EnemyDropItem(3, 3);
		SetCommonData("CD_Feverscore", GetCommonDataDefault("CD_Feverscore",0) + 3000);
		}
	AddScore(50000 * 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, 0);
	DrawGraphic(GetX, GetY);
	}
}