#東方弾幕風[Stage]
#Title[Nue(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 ~ "bg1 (1).png";
   let imagefile2 = GetCurrentScriptDirectory ~ "bg2 (2).png";
  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);
     
		stage2;
		//StageTask();//ステージタスク起動
	}
	
	@MainLoop()
	{y+=y2; 
	//if(stage>2){CreateEnemyBossFromFile(GetCurrentScriptDirectory~"sonic.txt",0,0,0,0,0); stage=0; }
		   y2+=0.0008;y3+=2;x+=3;wave+=2;
	yield;
	}
	
	@Finalize()
	{
		 
		
	
	}

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

      // Set up the view to rotate around the box
      SetViewTo(180, -210, 1000+sin(wave)*0.2);
      SetViewFrom(200, 15, 10);

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

      // Draw the box
     SetAlpha(255);
      SetTexture(imagefile);
      SetGraphicRect(0, 0, 5800, 12705*99+x*3);
SetGraphicScale(0.98,0.98);
      SetGraphicAngle(120, 70, 180);
      DrawGraphic3D(50,-150, 10);

	 

wave+=3;
	  
	  SetAlpha(155);
	  SetTexture(imagefile2);
      SetGraphicRect(0, 0, 5800, 1275*99+x*6);
SetGraphicScale(1,1);
       SetGraphicAngle(120, 70, 180);
       DrawGraphic3D(100,-150, 193);
	  
	SetAlpha(155);
	  SetTexture(imagefile2);
      SetGraphicRect(0, 0, 5800+x, 1275*99+x*3);
SetGraphicScale(1,1);
       SetGraphicAngle(120, 70, 180);
       DrawGraphic3D(100,-140, 193);
	  
	
	
	if(yy<GetCenterY){yy+=30;}
	if(yy>GetCenterY-250){yy+=0.3;}
	if(yy>300){yy+=50;}
     
   }
  
  
 
  

   task stage2{
 //PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\DesireDrive.mp3");
	wait(180);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"Nue.txt",0,-90,0,0,0);
WaitForZeroEnemy;
	wait(120);
Clear;	
   }
   
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   




