#e[Stage]
#Title[tFA[EIuET[N]
#Text[]
#BackGround[User(.\img\bg.png,0,-2)]
#BGM[]
#Player[FREE]
#PlayLevel[EXTRA]
#Image[.\img\image.png]
#ScriptVersion[2]

script_stage_main
{
	#include_function ".\init.txt"

	let cd = GetCurrentScriptDirectory();
	let img_title = cd ~ "img\title.png";
	let f_title = 0;
	let title_alpha = 0;
	let stage_start = 0;
	let stage = 7;
	let g_count = 0;

	@Initialize()
	{
		SetCommonData("stage", 1);

		SetShotAutoDeleteClip(16, 16, 16, 16);
		SetRateScoreSystemEnable(false);

		LoadGraphic(img_fairy);
		LoadGraphic(img_title);

		ExpertEx(false, 0, 3);

		T_Point();
		T_Count();
		T_Main();
	}

	@Finalize()
	{
		DeleteGraphic(img_fairy);
		DeleteGraphic(img_title);
	}

	@MainLoop()
	{
		yield;
	}

	@DrawTopObject()
	{
		if( f_title ){
			SetTexture(img_title);
			SetGraphicAngle(0, 0, 0);
			SetGraphicRect(0, 0, 384, 448);
			SetAlpha(title_alpha * 255 / 60);
			DrawGraphic(GetCenterX(), GetCenterY());
			SetAlpha(255);
		}
	}

	@BackGround()
	{
		BackGround7();
	}

	task T_ShowTitle()
	{
		f_title = 1;
		loop(60){
			title_alpha ++;
			yield;
		}
		Wait(120);
		loop(60){
			title_alpha --;
			yield;
		}
		f_title = 0;
	}

	task T_Point()
	{
		let extend_point = [180, 270, 360, -1];
		let extend_array = 0;

		SetNormPoint(extend_point[0]);

		loop{
			if( GetPoint() >= extend_point[extend_array] && extend_point[extend_array] > 0 ){
				extend_array ++;
				SetNormPoint(extend_point[extend_array]);
				CreateEnemyFromFile(GetCurrentScriptDirectory ~ "x0_extend.txt", GetClipMinX() - 16, 0, 0, 0, 0);
			}
			yield;
		}
	}

	task T_Count()
	{
		loop{
			g_count ++;
			yield;
		}
	}

	task T_Main()
	{
		T_Stage7();
	}

	#include_function ".\_stage7.txt"
	#include_function ".\f_base.txt"
}