#TouhouDanmakufu[Stage]
#Title[Sakuya Normal]
#Text[WADAHA]
#Player[FREE]
#ScriptVersion[2]

script_stage_main
{
	let bgm=GetCurrentScriptDirectory~"sakuyabgm.mp3";
   let bg_distance = 0;
   let bg_img = GetCurrentScriptDirectory~"img\stg5bg.png";

task stage
{
	loop(100){yield;}
	CreateEnemyBossFromFile(GetCurrentScriptDirectory~"Sakuya_n.txt", GetCenterX, GetClipMinY-20, 0, 0, 0);
	loop(240){yield;}
	PlayMusic(bgm);
	while(GetEnemyNum!=0){yield;}
	loop(60){yield;}
	Clear;
}
   @Initialize
   {
	LoadGraphic(bg_img);
		SetCommonData("ONSPELL", "FALSE");
	stage;
   }

   @MainLoop
   {
	yield;
   }

   @DrawLoop
   {
   }

   @BackGround
   {
	bg_distance++;
	if(bg_distance>270)
	{
	bg_distance-=270;
	}
	WriteZBuffer(true);
	UseZBuffer(true);
	SetViewTo(-bg_distance, 0, 0);
	SetViewFrom(650, 0, 50);
	SetPerspectiveClip(0, 4000);
	SetFog(500, 650, 0, 0, 0);

	SetTexture(bg_img);
	SetGraphicRect(15, 15, 81, 49);
	SetGraphicScale(2, 2);
	SetGraphicAngle(90, 90, 90);
	SetRenderState(ALPHA);
	ascent(i in -4..5)
	{
	ascent(j in -10..5)
	{
	DrawGraphic3D(j*90, 0, i*68);
	}
	}
	
	SetGraphicRect(163, 8, 239, 51);
	SetGraphicScale(1, 1);
	SetGraphicAngle(90, 90, 90);
	SetRenderState(ADD);
	ascent(i in 0..3)
	{
	ascent(j in -10..5)
	{
	SetGraphicAngle(90, 90, 90);
	DrawGraphic3D(j*90, i*60, 150);
	SetGraphicAngle(90, 90, 270);
	DrawGraphic3D(j*90, i*60, -150);
	}
	}
   }

   @Finalize
   {
   }
}
