
#Title[Spell01]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {let us=0;
  #include_function ".\AnimationLib.dnh"
  #include_function ".\N.txt"
 let yh=0;let yu=0;
  let imgNue = GetCurrentScriptDirectory ~ "KE.png";
  let cir = GetCurrentScriptDirectory ~ "circle.png";
  let cir2 = GetCurrentScriptDirectory ~ "circle.png";
  let qwe = GetCurrentScriptDirectory ~ "supershot.txt";
  let co=rand_int(1,5);
  let sp1= GetCurrentScriptDirectory ~ "spbg2.png";
  let sp2q= GetCurrentScriptDirectory ~ "sp2q.png";
  let sp2= GetCurrentScriptDirectory ~ "sp2.png";
  let sp22= GetCurrentScriptDirectory ~ "spbg1.png";
  let spn= GetCurrentScriptDirectory ~ "sn3.png";
  
   let Cut = GetCurrentScriptDirectory ~ "KeCut2.png";
 #include_function ".\function_cutin.txt"
 //#include_function ".\fam1.txt"
  #include_function ".\Halo.txt"
   let imagefile4 = GetCurrentScriptDirectory ~ "1q.png";
  @Initialize { 
  
  CreateAura01("RED",0,2);
   LoadUserShotData(qwe);
    SetLife(4500);
	SetTimer(80);
    //SetY(-120);
	d;
	  Explosion01(GetX,GetY,11,1,60);
 Explosion01(GetX,GetY,11,1,60);
	
	  
	  
	   CreateEnemyFromScript("fam",GetClipMaxX+150,GetCenterY,0,0,0);
	
	yim;
    LoadGraphic(imgNue);
    LoadGraphic(cir);
    LoadGraphic(cir2);
    LoadGraphic(Cut);
    LoadGraphic(imagefile4);
    LoadGraphic(sp1);
    LoadGraphic(spn);
    LoadGraphic(sp2);
    LoadGraphic(sp2q);
    LoadGraphic(sp22);
    // SetDurableSpellCard;
	 gro;
    InitializeAnimationData;
	  MagicCircle(false);
  
    Animate("nue", "idle", true);
   mus;
    ShowOffNueAnimation;
    // CreateAura01;
  }
  
  task yim{loop{yield;
  
   if(GetTimer<11&&GetTimer>=0){PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_timeout.wav");wait(60);}
 
  }}
  
  
 let da=0;
  task d{
  loop{
  
  if(da==0){
  SetDamageRate(0,0);}
   if(da==1){
  SetDamageRate(20,50);}
   if(da==2){
  SetDamageRate(60,50);}
  yield;
  }
  }
  
  @MainLoop {
  
  SetCollisionA(GetX,GetY,30);
  SetCollisionB(GetX,GetY-40,20);
  SetCollisionB(GetX,GetY,30);
  SetCollisionB(GetX,GetY+10,30);
    yield ;
   
    }
  let wave=0;
  let x=0;
  
  let xx=0;
  let aa=0;
  let yy=0;
  
  task u{
  b;
  c;
  
  
  task c{
  wait(70);
  loop(13){
  yield;
  yy+=7.6;
  }
  
  loop(10){
  yield;
  yy+=4;
  }
  loop(10){
  yield;
  yy+=3;
  }
  
  loop(10){
  yield;
  yy+=2;
  }
  
  
  loop(10){
  yield;
  yy+=1;
  }
  
  
  
  
  
  
  }
  
  
  
  task b{
  
  loop(60){
  yield;
  xx+=6;
  }
  }
  task a{
  loop(60){yield;
  ss+=0.033333;
  }
  }
  
  a;
  loop(90){
  yield;
  aa+=2.8;
  }
  
  
  
  }let ss=0;
  
   let x=0;let al=0;let si=0;
  let al1=0;let si1=0;
  task gro{
  gro2;
  loop(120){
  yield;
  al+=0.6;
  si+=0.003;
  }
  
  }
   task gro2{
  
  loop(190){
  wait(2);
  al1+=0.8;
  si1+=0.0015;
  }
  
  }
  @DrawLoop {
     
   
   
	    SetTexture(cir);SetAlpha(100);
 
	SetGraphicRect(0,0,128,127);
	SetGraphicScale(1.9+sin(wave)*0.2,1.9+sin(wave)*0.2);


	SetGraphicAngle(0, 0, -x);
	DrawGraphic(GetX,GetY);
	
	
	    SetTexture(cir);SetAlpha(100);
 
SetGraphicRect(0,0,128,127);
SetGraphicScale(1.9+sin(wave)*0.2,1.9+sin(wave)*0.2);

wave+=3;x+=2;
	SetGraphicAngle(0, 0, x);
	DrawGraphic(GetX,GetY);
  
  
	 
     SetTexture(spn);SetAlpha(aa);
 SetGraphicRect(0,0,648,80);
	
	SetGraphicScale(2.6-ss,2.7-ss);


	SetGraphicAngle(0,-xx, 0);
	DrawGraphic(GetCenterX+5,GetCenterY-yy+25);
	 
	 
  
      
   
	   
  
  
     SetTexture(imgNue);SetAlpha(255);
 SetGraphicRect(0,0,0,0);
	
	SetGraphicScale(0.8,0.8);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX,GetY);
	
	 DrawAnimatedSprite("nue", GetX, GetY-5*sin(h));
  

   h+=4;
  
  
  
  SetGraphicAngle(0, 0, 0);
SetGraphicScale(0.8,0.8);
   
   DrawText("Tenxka Shin",GetClipMinX,30,15,255);
  }let h=0;let ann=0;
  task mus{PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\Nue1.mp3");}
  
  
  
   @BackGround{
  
 
	 
	
  
   SetAlpha(255);
   SetTexture(imagefile4);SetColor(255,255,255);
      SetGraphicRect(0, 0, 1111, 1111);
SetGraphicScale(1,1);
      SetGraphicAngle(0, 0,180);
      DrawGraphic(GetCenterX,GetCenterY);
  
      SetTexture(sp1);SetAlpha(255);
 
	SetGraphicRect(0,0,384,448);
	SetGraphicScale(1,1);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX,GetCenterY);
	
	
	  SetTexture(sp2);SetAlpha(185);
 
	SetGraphicRect(0,0,864,600);
	SetGraphicScale(1,1);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX-77,GetCenterY);
	
	
	 SetTexture(sp2q);SetAlpha(65);
 
	SetGraphicRect(0,0,-684,848+cx);
	SetGraphicScale(1,1);

cx+=0.5;
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX,GetCenterY);
	
	
	
  
   SetAlpha(137);
   SetTexture(sp22);SetColor(255,255,255);
      SetGraphicRect(0, 0, 1111, 1111);
SetGraphicScale(1.7,1.7);
      SetGraphicAngle(0, 0,x/24);
      DrawGraphic(GetCenterX-133,GetCenterY-133);
	
  }
  
  let cx=0;
  let cx2=0;
  
  
  @Finalize {
    DeleteGraphic(imgNue);
   
  }
  
  
 
  

  let ax=0;
  let ay=0;
  let aan=0;
  let co=0;
  task ShowOffNueAnimation {
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_fault.wav");
  
  
  task ufoss{
  wait(420);
  loop{
  
  
  
  co=rand_int(1,4);
  
  if(co==1){
  ufos(0,rand(30,GetClipMaxY-30),0+rand(-40,40));
  }
  if(co==2){
  ufos(GetClipMaxX,rand(30,GetClipMaxY-30),180+rand(-40,40));
  }
  
  
  if(co==3){
  ufos(rand(30,GetClipMaxX-30),0,90+rand(-40,40));
  }
  
  if(co==4){
  ufos(rand(30,GetClipMaxX-30),GetClipMaxY,270+rand(-40,40));
  }
  
  wait(180);
  }
  
  }
  
  task ufos(x,y,an){
  
  
  
  
  
  
 let qw11 = Obj_Create(OBJ_LASER);
    // initial settings
   Obj_SetPosition   (qw11, x, y);
   Obj_SetAngle(qw11,an);
    ObjLaser_SetWidth (qw11, -5);
	Obj_SetCollisionToPlayer(qw11,false);
    ObjLaser_SetLength (qw11, 580);
    ObjShot_SetGraphic(qw11, 15);
    ObjShot_SetDelay(qw11, 45);
    ObjLaser_SetSource(qw11, false);
  let anglel=0;
  let anan=0;
  let anan2=0;
	wait(60);
  ObjShot_FadeDelete(qw11);
  let spe=0;
  task blasta{
  
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_don00.wav");
  loop(40){
  blast;
  anan+=360/40;
  }
  
  
  if(aw==0){
   loop(15){
   CreateShot01(Obj_GetX(obj),Obj_GetY(obj),0.7,anan+anan2,62,20);
  anan+=360/15;
  }anan2+=15.24654;}
  
  
  if(aw==1){
  
   loop(30){
   CreateShot01(Obj_GetX(obj),Obj_GetY(obj),0.8,anan+anan2,60,20);
  anan+=360/30;
  }anan2+=15.24654;}
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_kira00.wav");
 
  
  }
  
  task blast{
  let obj1=Obj_Create(OBJ_SHOT);
	Obj_SetX(obj1,Obj_GetX(obj));
	Obj_SetY(obj1,Obj_GetY(obj));
	Obj_SetSpeed(obj1,2);
	Obj_SetAngle(obj1,anan);
	ObjShot_SetBombResist(obj1,true);
	ObjShot_SetGraphic(obj1,152);
	ObjShot_SetDelay(obj1,10);
  
	
  loop(20){Obj_SetSpeed(obj1,Obj_GetSpeed(obj1)-0.1);wait(3);}
	ObjShot_FadeDelete(obj1);
  
  }
  
  
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_boon01.wav");
let obj=Obj_Create(OBJ_SHOT);
	Obj_SetX(obj,x);
	Obj_SetY(obj,y);
	Obj_SetSpeed(obj,3);
	Obj_SetAngle(obj,an);
	ObjShot_SetBombResist(obj,true);
	ObjShot_SetGraphic(obj,237);
	ObjShot_SetDelay(obj,10);
  chek;
  chek2;
  task chek{wait(60);
  loop{
  if(Obj_GetX(obj)<GetClipMinX){ blasta;yield;Obj_Delete(obj);break;}
  if(Obj_GetX(obj)>GetClipMaxX){blasta;yield;Obj_Delete(obj);break;}
  if(Obj_GetY(obj)<GetClipMinY){   blasta; yield;  Obj_Delete(obj);break;}
  if(Obj_GetY(obj)>GetClipMaxY){    blasta;yield;  Obj_Delete(obj);break;}
  
  
  yield;}}
  
  task chek2{
  
  while(!Obj_BeDeleted(obj)){yield;
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_kira00.wav");
  CreateShot01(Obj_GetX(obj),Obj_GetY(obj),2,Obj_GetAngle(obj)+180,251,20);
  wait(10);
  }
  
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  }
  
  
  
  
  
  
  //wait(60);
   if(GetX>GetCenterX){
	SetMovePosition03(GetCenterX, GetCenterY, 13, 3);
      SetNueMoveAnimation("left");}
	   if(GetX<GetCenterX){
	SetMovePosition03(GetCenterX, GetCenterY, 13, 3);
      SetNueMoveAnimation("right");}
	    if(GetX==GetCenterX){
	SetMovePosition03(GetCenterX, GetCenterY, 13, 3);
      SetNueMoveAnimation("right");}
      yield ;
      while(GetSpeed>0.1){yield;}
wait(90);
      Animate("nue", "start cast", false);
	  wait(20);
	  
	  SetScore(30000);
	  u;
	  cutin("NAZRIN", "",Cut,0,0,593,651);
	  //PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_boon01.wav");
	    
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_cat00.wav");
		
		 wait(20); 
		  Animate("nue", "stop cast", false);
	  wait(20);
	   Animate("nue", "idle", true);
	   
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");

	 Concentration02(30);
 Concentration02(40);
 Concentration02(30);let fg=0;
 Concentration02(40);
 Concentration02(30);let anga=0;
 Concentration02(40);
	 
	   wait(120);
      Animate("nue", "start cast", false);
	  wait(20);
	  ////////////
	  
	  
	  
	 da=1; cross;
	  
	  
	  ////////////////////
	  wait(100); 
		  Animate("nue", "stop cast", false);
	 wait(20);
	   Animate("nue", "idle", true);
	 
	 wait(630);da=2;
	 ufoss;
	 	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");

	 Concentration02(30);
 Concentration02(40);
 Concentration02(30);let fg=0;
 Concentration02(40);
 Concentration02(30);let anga=0;
 Concentration02(40);
	 
	   wait(120);
      Animate("nue", "start cast", false);
	  wait(20);
	  ////////////
	  
	  
	  
	  lasers;
	  
	  
	  ////////////////////
	  wait(100); 
		  Animate("nue", "stop cast", false);
	 wait(20);
	   Animate("nue", "idle", true);
	 
	 }
  
  
  
  let gg=0;let ggg=0;
  let wan=0;let wan2=0;
 
  task SetNueMoveAnimation(direction) {
  
     if(direction == "left"){ann=180;
      Animate("nue", "start move right", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue", "stop move right", false);
    }
   
   
   
    if(direction == "right"){ann=0;
      Animate("nue", "start move right", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue", "stop move right", false);
    }
    wait(18);ann=0;
    Animate("nue", "idle", true);
  }
  
  function wait(t){
    loop(t){yield;}
  }
 
  sub InitializeAnimationData {
     CreateAnimation("nue", "idle", 4);
    SetAnimationFrame("nue", "idle", 0, imgNue, rand_int(60,180),15, 10, 138, 176);

    SetAnimationFrame("nue", "idle", 1, imgNue, 12, 148,7, 272, 174);
    SetAnimationFrame("nue", "idle", 2, imgNue, 12, 283, 5, 410, 172);
     SetAnimationFrame("nue", "idle", 3, imgNue, 12, 148,7, 272, 174);
    
	
	
    CreateAnimation("nue", "start move right", 2);
    SetAnimationFrame("nue", "start move right", 0, imgNue, 8, 22, 185, 142, 351);
    SetAnimationFrame("nue", "start move right", 1, imgNue, 8, 156, 184, 277, 351);
   
    
    CreateAnimation("nue", "stop move right", 2);
    SetAnimationFrame("nue", "stop move right", 0,  imgNue, 8, 156, 184, 277, 351);
    SetAnimationFrame("nue", "stop move right", 1,  imgNue,8, 22, 185, 142, 351);
   
    
	
	
	
    CreateAnimation("nue", "start move left", 2);
    SetAnimationFrame("nue", "start move left", 0, imgNue, 8, 6, 285, 127, 408);
    SetAnimationFrame("nue", "start move left", 1, imgNue, 8, 141, 286, 259, 407);
   
    
    CreateAnimation("nue", "stop move left", 2);
    SetAnimationFrame("nue", "stop move left", 0,imgNue, 8, 141, 286, 259, 407);
    SetAnimationFrame("nue", "stop move left", 1,imgNue, 8, 6, 285, 127, 408);
   
    
    CreateAnimation("nue", "start cast", 2);
   
    SetAnimationFrame("nue", "start cast", 0, imgNue, 12, 148,7, 272, 174);
    SetAnimationFrame("nue", "start cast", 1, imgNue, 12, 283, 5, 410, 172);
   
    
    CreateAnimation("nue", "stop cast",2);
    SetAnimationFrame("nue", "stop cast", 0,imgNue, 12, 283, 5, 410, 172);
    SetAnimationFrame("nue", "stop cast", 1,imgNue, 12, 148,7, 272, 174);
    
  } let wa=500;
 let yt=0;
  
  
  let waw=3;
  
  let ana=0;
  let ana2=0;
  let ana3=0;
  
   waw=3;
  
   ana=0;
   ana2=0;
   ana3=0;
  
  
  
  
  
  
  
  let anga=0;
let anga2=0;


  task cross{
  
  
  loop(10){
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_kira00.wav");
  loop(20){
  
  
   CreateShotA(1,GetX, GetY,5);
		SetShotDataA(1,0,1,anga+anga2,1,0,0,82);
		SetShotDataA(1,60,1.1,NULL,0.5,0,0,82);
		SetShotDataA(1,120,1.2,NULL,0.3,0,0,82);
				FireShot(1);
				
				
				  CreateShotA(1,GetX, GetY,5);
		SetShotDataA(1,0,1,anga+anga2,-1,0,0,82);
		SetShotDataA(1,60,1.1,NULL,-0.5,0,0,82);
		SetShotDataA(1,120,1.2,NULL,-0.3,0,0,82);
				FireShot(1);
  
  anga+=360/20;
  }anga2+=13.563234;
  wait(70);
  }
  
  
  }
  
  
  task lasers{
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_lazer00.wav");
  laser(110);
  
  }
  
  
  
  
  let angle=0;
  
  
  
  let aw=0;
  
  let ang=0;let rar=-10;
  task laser(an){
  
  
  
  
  
 let qw1 = Obj_Create(OBJ_LASER);
   
   Obj_SetPosition   (qw1, GetX,GetY);
   Obj_SetAngle(qw1,an+angle);
    ObjLaser_SetWidth (qw1, 15);
	
    ObjLaser_SetLength (qw1, 0);
    ObjShot_SetGraphic(qw1, rand_int(1,8));
    ObjShot_SetDelay(qw1, 15);
    ObjLaser_SetSource(qw1, true);
  let anglel=0;
  let anglel2=0;
  
  
  gfgd;
  let fas=0;
  task gfgd{
  
 
   loop{yield;
   
fas=rand_int(139,148);
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
   loop(5){
  CreateShot01(GetX-(rar*cos(290+ang)),GetY-rar*sin(290+ang),0.9,anglel+anglel2,fas,5);
 
 anglel2+=360/5;
 
 }anglel+=14.5456;
 
 wait(30);
 
  }
  }
  
  
  
  
  gg;
  loop(120){
 ObjLaser_SetLength (qw1,  ObjLaser_GetLength (qw1)+0.5);yield;rar+=0.5;
 
}
  task gg{loop{yield;Obj_SetAngle(qw1,Obj_GetAngle(qw1)+1);ang+=1;}}
  while(!Obj_BeDeleted(qw1)){yield;
	Obj_SetAutoDelete(qw1,true);


wait(rand(60,180));
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");

	 Concentration02(30);
 Concentration02(40);
 Concentration02(30);let fg=0;
 Concentration02(40);
 Concentration02(30);let anga=0;
 Concentration02(40);
	 
	   wait(120); loop(20){
  
  
   CreateShotA(1,GetX, GetY,5);
		SetShotDataA(1,0,1,anga+anga2,1,0,0,82);
		SetShotDataA(1,60,1.1,NULL,0.5,0,0,82);
		SetShotDataA(1,120,1.2,NULL,0.3,0,0,82);
				FireShot(1);
				
				
				  CreateShotA(1,GetX, GetY,5);
		SetShotDataA(1,0,1,anga+anga2,-1,0,0,82);
		SetShotDataA(1,60,1.1,NULL,-0.5,0,0,82);
		SetShotDataA(1,120,1.2,NULL,-0.3,0,0,82);
				FireShot(1);
  
  anga+=360/20;
  }
 ObjShot_SetGraphic(qw1, rand_int(1,8));aw=0;
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_lazer00.wav");
loop(120){
 ObjLaser_SetLength (qw1,  ObjLaser_GetLength (qw1)+2);yield;rar+=2;
 
}

wait(rand(60,380));
 loop(20){
  
  
   CreateShotA(1,GetX, GetY,5);
		SetShotDataA(1,0,1,anga+anga2,1,0,0,82);
		SetShotDataA(1,60,1.1,NULL,0.5,0,0,82);
		SetShotDataA(1,120,1.2,NULL,0.3,0,0,82);
				FireShot(1);
				
				
				  CreateShotA(1,GetX, GetY,5);
		SetShotDataA(1,0,1,anga+anga2,-1,0,0,82);
		SetShotDataA(1,60,1.1,NULL,-0.5,0,0,82);
		SetShotDataA(1,120,1.2,NULL,-0.3,0,0,82);
				FireShot(1);
  
  anga+=360/20;
  }
 ObjShot_SetGraphic(qw1, rand_int(1,8));
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_lazer00.wav");aw=1;
loop(120){
 ObjLaser_SetLength (qw1,  ObjLaser_GetLength (qw1)-2);yield;rar+=-2;
 
}



  }
  
  
  }
  
  
  
  
  
  
  
  


}
  
  
  
  
  








////////////////////////////





script_enemy fam{

 #include_function ".\AnimationLib.dnh"

let wave=0;
let x=0;

let fi=0;
    let imgNue = GetCurrentScriptDirectory ~ "Nue.png";
    let gr2 = GetCurrentScriptDirectory ~ "circle22.png";
	 let cir = GetCurrentScriptDirectory ~ "circle.png";
  let cir2 = GetCurrentScriptDirectory ~ "circle2.png";
	  let gr3 = GetCurrentScriptDirectory ~ "circle23.png";
    let gr23 = GetCurrentScriptDirectory ~ "circle223.png";
	
  let dir=0;
  let r=80;
  #include_function ".\Halo.txt"
   
  @Initialize { 
  
  //CreateAura01("RED",0,2);
  
 CreateAura03("RED",0,0,1,1,0);
  
  SetLife(2000);
  LoadGraphic(imgNue);
  LoadGraphic(gr2);
  LoadGraphic(gr3);
  LoadGraphic(gr23);
  
  InitializeAnimationData2;
main; 
 }
  @MainLoop{yield;
  //SetCollisionA(GetX, GetY, 17);
        //SetCollisionB(GetX, GetY, 16);
  }
  let asa=0;let h=0;
  @DrawLoop{
  
	   
	    SetTexture(cir);SetAlpha(100);
 
	SetGraphicRect(0,0,128,127);
	SetGraphicScale(1.9+sin(wave)*0.2,1.9+sin(wave)*0.2);


	SetGraphicAngle(0, 0, -x);
	DrawGraphic(GetX,GetY);
	
	
	    SetTexture(cir);SetAlpha(100);
 
SetGraphicRect(0,0,128,127);
SetGraphicScale(1.9+sin(wave)*0.2,1.9+sin(wave)*0.2);

wave+=3;x+=2;
	SetGraphicAngle(0, 0, x);
	DrawGraphic(GetX,GetY);
	
	
  
  
   SetTexture(imgNue);SetAlpha(255);
 SetGraphicRect(0,0,0,0);
	
	SetGraphicScale(1.2,1.2);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX,GetY);
      DrawAnimatedSprite("nue2", GetX, GetY-5*sin(h)-10);
  

   h+=4;
  
	
  }
  @Finalize{
  //PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_option.wav");
  
   
	
  }
  let angle=0;let sps=0;let ra=10;
  task fire{
  
  
  loop(8){
  
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
  loop(20){
  bul(angle+ra);
  angle+=360/20;
  }ra+=16.345;
  wait(90);
  
  
  }
  
  wait(10);
  
  Animate("nue2", "stop cast", false);
    wait(14);
	
  Animate("nue2", "idle", true);
  wait(20);
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");

	 Concentration02(30);
 Concentration02(40);
 Concentration02(30);let fg=0;
 Concentration02(40);
 Concentration02(30);let anga=0;
 Concentration02(40);
	 
  
  Animate("nue2", "start move left", false);
      yield ;
   SetMovePosition03(GetCenterX,GetCenterY-1220,15,4);
  wait(120);
  
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ufoalert.wav");
	   wait(30);
	   
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ufoalert.wav");
	   wait(30);
	    PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ufoalert.wav");
	   wait(30);
	   
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ufoalert.wav");
	   wait(30);
  VanishEnemy;
  
  }
  
    task bul(an){
	
	
	
	
  
let obj=Obj_Create(OBJ_SHOT);
	Obj_SetX(obj,GetX);
	Obj_SetY(obj,GetY-60);
	Obj_SetSpeed(obj,2);
	Obj_SetAngle(obj,an);
	ObjShot_SetBombResist(obj,true);
	ObjShot_SetGraphic(obj,30);
	ObjShot_SetDelay(obj,10);
	yield;
	ff;
	task ff{
	loop(20){Obj_SetSpeed(obj,Obj_GetSpeed(obj)-0.1);wait(2);}
	wait(10);
	loop(20){Obj_SetSpeed(obj,Obj_GetSpeed(obj)+0.1);wait(5);}}
	task brek{

	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_kira00.wav");
	CreateShot01(Obj_GetX(obj),Obj_GetY(obj),rand(0.8,1),(180-Obj_GetAngle(obj))+rand(-10,10),56,10);
	
	}
	task brek2{

	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_kira00.wav");
	CreateShot01(Obj_GetX(obj),Obj_GetY(obj),rand(0.8,1),-Obj_GetAngle(obj)+rand(-10,10),56,10);
	
	}
	
	while(!Obj_BeDeleted(obj)){
yield;

if(Obj_GetX(obj)<GetClipMinX){




brek;wait(2);
Obj_Delete(obj);

}



if(Obj_GetX(obj)>GetClipMaxX){




brek;wait(2);
Obj_Delete(obj);

}




if(Obj_GetY(obj)<GetClipMinY){



brek2;wait(2);
Obj_Delete(obj);




}


}
	
	
	
	
	
 }
  
  task main{ 
  
  
  Animate("nue2", "start move left", false);
      yield ;
   SetMovePosition03(GetCenterX,GetCenterY-120,15,4);
    wait(60);
 Animate("nue2", "stop move left", false);
      wait(30);
	   Animate("nue2", "idle", true);
      wait(60);
	  
	  
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");
	  
	 Concentration02(30);
 Concentration02(40);
 Concentration02(30);let fg=0;
 Concentration02(40);
 Concentration02(30);let anga=0;
 Concentration02(40);
	 
	   wait(120);
	  
	  
	  
      Animate("nue2", "start cast", false);
	  wait(25);
	    Animate("nue2", "brr", true);
	 fire;
     // wait(30);
     // Animate("nue2", "stop cast", false);
     // wait(16);
     // Animate("nue2", "idle", true);
  
  }
  
  
  let angle2=0;
 
  let a=0;let s=0;let g=0;
  
  
  
  
   function wait(t){
    loop(t){yield;}
  }
  
  
  
  
  
  
  
  
  
  
  
  
  task SetNueMoveAnimation(direction) {
    if(direction == "left"){
      Animate("nue2", "start move left", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue2", "stop move left", false);
    }
    if(direction == "right"){
      Animate("nue2", "start move right", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue2", "stop move right", false);
    }
    wait(12);
    Animate("nue2", "idle", true);
  }
  
  
  
  
  
  
  /////
  sub InitializeAnimationData2 {
    CreateAnimation("nue2", "idle", 4);
    SetAnimationFrame("nue2", "idle", 0, imgNue, 12, 0, 0, 96, 112);
    SetAnimationFrame("nue2", "idle", 1, imgNue, 12, 96, 0, 192, 112);
    SetAnimationFrame("nue2", "idle", 2, imgNue, 12, 192, 0, 288, 112);
    SetAnimationFrame("nue2", "idle", 3, imgNue, 12, 288, 0, 384, 112);
    
    CreateAnimation("nue2", "start move right", 4);
    SetAnimationFrame("nue2", "start move right", 0, imgNue, 8, 0, 112, 96, 224);
    SetAnimationFrame("nue2", "start move right", 1, imgNue, 8, 96, 112, 192, 224);
    SetAnimationFrame("nue2", "start move right", 2, imgNue, 8, 192, 112, 288, 224);
    SetAnimationFrame("nue2", "start move right", 3, imgNue, 8, 288, 112, 384, 224);
    
    CreateAnimation("nue2", "stop move right", 3);
    SetAnimationFrame("nue2", "stop move right", 0, imgNue, 4, 288, 112, 384, 224);
    SetAnimationFrame("nue2", "stop move right", 1, imgNue, 4, 192, 112, 288, 224);
    SetAnimationFrame("nue2", "stop move right", 2, imgNue, 4, 96, 112, 192, 224);
    
    CreateAnimation("nue2", "start move left", 4);
    SetAnimationFrame("nue2", "start move left", 0, imgNue, 8, 0, 224, 96, 336);
    SetAnimationFrame("nue2", "start move left", 1, imgNue, 8, 96, 224, 192, 336);
    SetAnimationFrame("nue2", "start move left", 2, imgNue, 8, 192, 224, 288, 336);
    SetAnimationFrame("nue2", "start move left", 3, imgNue, 8, 288, 224, 384, 336);
    
    CreateAnimation("nue2", "stop move left", 3);
    SetAnimationFrame("nue2", "stop move left", 0, imgNue, 4, 288, 224, 384, 336);
    SetAnimationFrame("nue2", "stop move left", 1, imgNue, 4, 192, 224, 288, 336);
    SetAnimationFrame("nue2", "stop move left", 2, imgNue, 4, 96, 224, 192, 336);
    
    CreateAnimation("nue2", "start cast", 5);
    SetAnimationFrame("nue2", "start cast", 0, imgNue, 4, 0,336,96,448);
    SetAnimationFrame("nue2", "start cast", 1, imgNue, 4, 96,336,192,448);
    SetAnimationFrame("nue2", "start cast", 2, imgNue, 4, 192,336,288,448);
    SetAnimationFrame("nue2", "start cast", 3, imgNue, 4, 288,336,384,448);
    SetAnimationFrame("nue2", "start cast", 4, imgNue, 4, 384,336,480,448);
    
	
	
	 CreateAnimation("nue2", "brr", 2);
    
    SetAnimationFrame("nue2", "brr", 0, imgNue, 13, 288,336,384,448);
    SetAnimationFrame("nue2", "brr", 1, imgNue, 13, 384,336,480,448);
	
    CreateAnimation("nue2", "stop cast", 4);
    SetAnimationFrame("nue2", "stop cast", 0, imgNue, 4, 384,336,480,448);
    SetAnimationFrame("nue2", "stop cast", 1, imgNue, 4, 288,336,384,448);
    SetAnimationFrame("nue2", "stop cast", 2, imgNue, 4, 192,336,288,448);
    SetAnimationFrame("nue2", "stop cast", 3, imgNue, 4, 96,336,192,448);
 
  }
  
  
  
  
  
  
  
  }
  

