script_enemy_main {
   let time = 0;
   let phase = 1;
   let rate = 6;
   let kaku = 30;
   let score = 800;
   let lv = 0;
   let angle = GetAngle();
   let rank = GetSpeed();
   let arg = GetArgument();
   let ex = GetCommonData("ex");
   let imgEnemy = GetCurrentScriptDirectory~"img\air5.png";
   let tama = GetCurrentScriptDirectory~"tama.txt";
   let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
   let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
   let se3 = GetCurrentScriptDirectory~"wav\se3.wav";
   @Initialize(){
       SetLife( 170 );
       SetInvincibility( 60 );
       SetSpeed(0);
       LoadGraphic( imgEnemy );
       LoadUserShotData( tama );
       Tshot1;Tmove1;
   }
   @MainLoop {
   	if(time==5){
   		CreateEnemyFromScript("parts", GetX+40, GetY, 0, 0, 1);
   		CreateEnemyFromScript("parts", GetX-40, GetY, 0, 0,-1);
   	}
      if(phase==1&&GetLife<=100){
         phase-=1;
         if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, GetX, GetY, 55);}
         PlaySE(se2);
         Tdeath(10,48,1,1);
      }
      if(phase>=1&&time>50){
         SetCollisionA(GetX, GetY, 32);
         SetCollisionB(GetX, GetY, 32);
      }
      if(GetCommonData("kakusei")>0){lv=1}
      else{lv=0}
      time++;
      yield;
   }
   @Finalize() {
   }
   @DrawLoop {
		SetTexture( imgEnemy );
   	if(time<50){
			SetAlpha(time*5);
   	}
		SetGraphicRect( 0, 0, 128, 96 );
		SetGraphicAngle(0,0,0);
		DrawGraphic( GetX(), GetY() );
		SetAlpha(255);
	}

   task Tshot1{
       yield;
       wait(60);
       let a=0;
       loop{
          if(phase<=0){return;}
          if(GetY<330){
            let b=-1;
            SetShotDirectionType(ABSOLUTE);
          	loop(3){
                /*CreateShotFromScript( "shot1",GetX()+50, GetY()-20, 2.2, 90+sin(a*73)*70+b*40, 0, 11);
                CreateShotFromScript( "shot1",GetX()-50, GetY()-20, 2.2, 90-sin(a*73)*70-b*40, 0, 11);*/
                /*CreateShotFromScript( "shot1",GetX(), GetY(), 2.2, 90+55-a%110+b*40, 0, 14);*/
                b++;
          	}
          }
       	a+=rand(60,100);
          wait(4-lv*2);
       }
   }
   task Tmove1 {
       wait(60);
       SetMovePosition02(GetX, GetY+500, 600);
       wait(600);
       VanishEnemy();
   }





   #include_function".\efanction.txt"
}
script_enemy parts {
   let time = 0;
   let phase = 1;
   let rate = 2;
   let kaku = 10;
   let score = 200;
   let lv = 0;
   let angle = GetAngle();
   let rank = GetSpeed();
   let arg = GetArgument();
   let ex = GetCommonData("ex");
   let imgEnemy = GetCurrentScriptDirectory~"img\air5.png";
   let tama = GetCurrentScriptDirectory~"tama.txt";
   let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
   let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
   let se3 = GetCurrentScriptDirectory~"wav\se3.wav";
   @Initialize(){
       SetLife( 115 );
       SetInvincibility( 55 );
       SetSpeed(0);
       LoadGraphic( imgEnemy );
       LoadUserShotData( tama );
       Tshot1;Tmove1;
   }
   @MainLoop {
   	if(BeParentVanished==true){
   		VanishEnemy();
   	}
      if(phase==1&&GetLife<=100){
         phase-=1;
         if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, GetX, GetY, 30);}
         PlaySE(se3);
         Tdeath(2,24,1,1);
      }
      if(phase>=1&&time>45){
         SetCollisionA(GetX, GetY, 24);
         SetCollisionB(GetX, GetY, 16);
      }
      if(GetCommonData("kakusei")>0){lv=1}
      else{lv=0}
      time++;
      yield;
   }
   @Finalize() {
   }
   @DrawLoop {
	SetTexture( imgEnemy );
   	if(time<50){
			SetAlpha(time*5);
   	}
      SetGraphicRect( 64, 96, 64+64*arg, 192 );
      SetGraphicAngle(0,0,0);
		DrawGraphic( GetX(), GetY() );
		SetAlpha(255);
   }

   task Tshot1{
       yield;
       wait(55);
       let a=0;
       loop{
          if(phase<=0){return;}
          if(GetY<330){
            let b=-1;
            SetShotDirectionType(ABSOLUTE);
          	loop(4+ex){
                /*CreateShotFromScript( "shot1",GetX()+50, GetY()-20, 2.2, 90+sin(a*73)*70+b*40, 0, 11);
                CreateShotFromScript( "shot1",GetX()-50, GetY()-20, 2.2, 90-sin(a*73)*70-b*40, 0, 11);*/
                CreateShotFromScript( "shot1",GetX(), GetY()-6, 2.2+rand(0.5,2.0)*ex, 90+(30-(a+b*40)%110)*arg, 0, 14);
                b++;
         	}
         }
       	a+=rand(60,100);
       	wait(6-lv*4);
       }
   }
   task Tmove1 {
       wait(55);
       SetMovePosition02(GetX, GetY+500, 600);
       wait(600);
       VanishEnemy();
   }





   #include_function".\efanction.txt"
}

#include_script".\escript.txt"