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

script_stage_main
{
   let bg_distance = 0;
   let bgrot=0;
   let bg_img = GetCurrentScriptDirectory~"img\stgbg.png";
	let bgm=GetCurrentScriptDirectory~"alicebgm.mp3";

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

   @MainLoop
   {
	yield;
   }

   @DrawLoop
   {
   }

   @BackGround
   {
	bg_distance+=0.5;
	if(bg_distance>512){bg_distance-=512;}
	bgrot+=0.5;

	WriteZBuffer(true);
	UseZBuffer(true);
	SetViewTo(-bg_distance, 0, 0);
	SetViewFrom(300, 0, 50);
	SetPerspectiveClip(0, 2000);

	SetTexture(bg_img);
	SetGraphicRect(0, 0, 256, 512);
	SetGraphicScale(1, 1);
	SetGraphicAngle(90, 90, 0);
	SetRenderState(ALPHA);
	ascent(i in -1..2)
	{
	DrawGraphic3D(i*512, 0, 0);
	}
	
	SetTexture(bg_img);
	SetGraphicRect(257, 1, 383, 127);
	SetGraphicScale(1, 1);
	SetGraphicAngle(90, 90, bgrot);
	SetRenderState(ALPHA);
	SetAlpha(150);
	DrawGraphic3D(-bg_distance-50, 1, 0);

	SetTexture(bg_img);
	SetGraphicRect(256, 256, 512, 512);
	SetGraphicScale(1, 1);
	SetGraphicAngle(90, 90, 0);
	SetRenderState(ALPHA);
	ascent(i in -1..2)
	{
	ascent(j in -3..4)
	{
	DrawGraphic3D(j*256, 0, i*256);
	}
	}
   }

   @Finalize
   {
   }
}
