#東方弾幕風[Stage]
#Title[Koishi(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 imagefile3 = GetCurrentScriptDirectory ~ "1.jpg";
   let imagefile4 = GetCurrentScriptDirectory ~ "1q.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);
      LoadGraphic(imagefile3);
      LoadGraphic(imagefile4);
     
		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;let x=255;
	@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(imagefile3);SetColor(255,255,255);
      SetGraphicRect(0, 0, -800-wave/2.5, 485);
SetGraphicScale(1,1);
      SetGraphicAngle(0, 0,180);
      DrawGraphic(GetCenterX,GetCenterY);
	  
	  
	   SetAlpha(255);
	  
      SetTexture(imagefile2);SetColor(255,255,255);
      SetGraphicRect(0, 0, -800-wave/2.5, 485);
SetGraphicScale(1,1);
      SetGraphicAngle(0, 0,180);
      DrawGraphic(GetCenterX,GetCenterY);
	  
	  
	   SetAlpha(255);
	  
      SetTexture(imagefile2);SetColor(255,255,255);
      SetGraphicRect(0, 0, 800+wave/2.5, 486);
SetGraphicScale(1,1);
      SetGraphicAngle(0, 0, 0);
      DrawGraphic(GetCenterX,GetCenterY+0);
	  
	   SetAlpha(255);
	  
      SetTexture(imagefile);SetColor(40,40,40);
      SetGraphicRect(0, 0, 800+wave, 979);
SetGraphicScale(0.2,0.2);
      SetGraphicAngle(0, 0, 0);
      DrawGraphic(GetCenterX,GetCenterY);
	  
	   SetAlpha(255);
	  
      SetTexture(imagefile);SetColor(95,95,95);
      SetGraphicRect(0, 0, 800+wave, 979);
SetGraphicScale(0.25,0.25);
      SetGraphicAngle(0, 0, 0);
      DrawGraphic(GetCenterX,GetCenterY);
	  
	  
	  SetAlpha(255);
	  
      SetTexture(imagefile);SetColor(145,145,145);
      SetGraphicRect(0, 0, 800+wave, 979);
SetGraphicScale(0.3,0.3);
      SetGraphicAngle(0, 0, 0);
      DrawGraphic(GetCenterX,GetCenterY);
	  
	  SetAlpha(255);
	  
      SetTexture(imagefile);SetColor(200,200,200);
      SetGraphicRect(0, 0, 800+wave, 979);
SetGraphicScale(0.4,0.4);
      SetGraphicAngle(0, 0, 0);
      DrawGraphic(GetCenterX,GetCenterY);
	  
	  
     SetAlpha(255);SetColor(255,255,255);
      SetTexture(imagefile);
      SetGraphicRect(0, 0, 800+wave, 979);
SetGraphicScale(0.5,0.5);
      SetGraphicAngle(0, 0, 0);
      DrawGraphic(GetCenterX,GetCenterY);

	 
	 
	  SetAlpha(x);
	  
      SetTexture(imagefile4);SetColor(255,255,255);
      SetGraphicRect(0, 0, 1111, 1111);
SetGraphicScale(1,1);
      SetGraphicAngle(0, 0,180);
      DrawGraphic(GetCenterX,GetCenterY);
	 
	 

wave+=-0.1;

	
	if(yy<GetCenterY){yy+=30;}
	if(yy>GetCenterY-250){yy+=0.3;}
	if(yy>300){yy+=50;}
     
   }
  
  
 
  

   task stage2{
   wait(320);
 //PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\DesireDrive.mp3");
	
	loop(254){
	yield;
	x-=1;
	}wait(180);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"Koishi.txt",0,-90,0,0,0);
WaitForZeroEnemy;
	wait(120);
Clear;	
   }
   
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   




