#東方弾幕風[Stage]
#Title[Tenxka Boss Fight(BG)]
#Text[]
#Image[]
#BackGround[Default]
#BGM[]
#Player[FREE]
#ScriptVersion[2]

script_stage_main
{ let rotation = 0; function wait(n) {loop(n){yield;} }
let egg= GetCurrentScriptDirectory ~ "dungeon2.png";
let egg2= GetCurrentScriptDirectory ~ "dungeon.png";
let stage=3;
let yy=-100;
let xx=GetCenterX-100;
   let imagefile = GetCurrentScriptDirectory ~ "bg.png";
   let imagefile2 = GetCurrentScriptDirectory ~ "bgd2.png";
   let imagefile3 = GetCurrentScriptDirectory ~ "bgd.png";
   let imagefile4 = GetCurrentScriptDirectory ~ "12.jpg";
  let xxx=0;
let x=0; let y=-10; let z=63; let y3=0;
   // Set this to false to see what happens without the depth buffer.
   let depth_buffer_enable = true; let y2=0;
	  function WaitForZeroEnemy{
    while(GetEnemyNum != 0){yield;}
  } 
	@Initialize()
	{LoadGraphic(imagefile);
      LoadGraphic(imagefile2);
      LoadGraphic(imagefile3);
      LoadGraphic(imagefile4);
     
		stage2;
		//StageTask();//ステージタスク起動
	}
	
	@MainLoop()
	{y+=y2; 
		   y2+=0.0008;y3+=2;x+=1;
	yield;
	}
	
	@Finalize()
	{
		 
		
	
	}

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	let wave=0;
	@BackGround()
	{ WriteZBuffer(depth_buffer_enable);
      UseZBuffer(depth_buffer_enable);

      // Set up the view to rotate around the box
      SetViewTo(0, 0, 0);
      SetViewFrom(90, 20,22);

      // Set the fog
      // Arguments: start distance , end distance , red , green , blue
      SetFog(140, 40, 10, 0, 0);

      // Draw the box
	  
	  
	  
	  
	   SetAlpha(255);
      SetTexture(imagefile4);
      SetGraphicRect(0, 0, 12705*99-x*2,1000 );
SetGraphicScale(0.4,0.4);
      SetGraphicAngle(-0, -20, 0);
      DrawGraphic3D(-311,-110, 0);

	  
	  
	   SetAlpha(255);
      SetTexture(imagefile4);
      SetGraphicRect(0, 0, 12705*99-x*2,1000 );
SetGraphicScale(0.4,0.4);
      SetGraphicAngle(-0, -20, 0);
      DrawGraphic3D(311,-110, 0);
	  
	  
	 
	  
	  
	  
	  
	  
	  
     SetAlpha(255);
      SetTexture(imagefile4);
      SetGraphicRect(0, 0, 1000, 12705*99-x*4);
SetGraphicScale(0.2,0.2);
      SetGraphicAngle(-90, 70, 180);
      DrawGraphic3D(0,-210, 0);

	
wave+=3;
	  
	
	SetAlpha(180);
      SetTexture(imagefile3);
      SetGraphicRect(0, 0,800, 800);
SetGraphicScale(1.2,1.2);
      SetGraphicAngle(0, 0, 0);
     DrawGraphic(GetCenterX,GetCenterY);
	 
	 
	 
	SetAlpha(180);
      SetTexture(imagefile2);
      SetGraphicRect(0, 0,1912, 1656);
SetGraphicScale(0.9,0.9);
      SetGraphicAngle(0, 0, 0);
     DrawGraphic(GetPlayerX,GetPlayerY);
	
	
	if(yy<GetCenterY){yy+=30;}
	if(yy>GetCenterY-250){yy+=0.3;}
	if(yy>300){yy+=50;}
  }
  
   let alph=0;
	  let sc=0;
	  
	  let xs=311;
	  let ys=0;
	  
 
  
task ds{loop(120){yield;xs+=-1;}}
   task stage2{ds;
 //PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\levl.mp3");
	wait(180);
	gg=1;
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"Tenxka.txt",GetCenterX,GetClipMinY-150,0,0,0);
WaitForZeroEnemy;
	
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"Spell08.txt",GetCenterX,GetClipMinY-100,0,0,0);
WaitForZeroEnemy;
	
	
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"Spell081.txt",GetCenterX,GetClipMinY-100,0,0,0);
WaitForZeroEnemy;
Clear;	
   }
   let gg=0;
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   




