#ScriptVersion[2]

script_enemy_main
{
	#include_function ".\init.txt"

	@Initialize
	{
		SetLife(25);
		SetScore(5000);

		SetTexture(img_fairy);

		LoadUserShotData(shot_00);

		InitializeAction();
		SetFairyType(2);

		T_Main();
		T_HitTest(16);
	}

	@Finalize
	{
		if( GetLife() <= 0 ){
			if( hypot(GetX() - GetPlayerX(), GetY() - GetPlayerY()) < 100 ){
				CreateItemCircle(GetX() - 8, GetY(), 1, 0);
				CreateItemCircle(GetX() + 8, GetY(), 1, 0);
			}
			else{
				CreateItemCircle(GetX(), GetY(), 1, 0);
			}
		}
	}

	@DrawLoop
	{
		DrawGraphic(GetX(), GetY());
	}

	task T_Main()
	{
		yield;

		T_Move();
		T_Shot();
		Wait(10);

		loop{
			if( IsOutOfClipRange(GetX(), GetY(), 16) ){
				VanishEnemy();
			}
			yield;
		}
	}

	task T_Move()
	{
		let v = 2.0;

		loop{
			SetSpeed(v);
			v += 0.08;
			yield;
		}
	}

	task T_Shot()
	{
		Wait(5 + rand_int(0, 13));
		loop{
			PlaySE(se_shot1);
			CreateShot02(GetX(), GetY(), 0.0, rand(75, 105), rand(0.02, 0.035), 10.0, 205, 10);
			Wait(14);
		}
	}

	#include_function ".\f_base.txt"
	#include_function ".\f_enemy.txt"
	#include_function ".\f_anime_fairy.txt"
}
