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

script_enemy_main {#include_function ".\Halo.txt"
  #include_function ".\AnimationLib.dnh"
  #include_function ".\function_cutin.txt"
  let imgNue = GetCurrentScriptDirectory ~ "KE.png";
  let Cut = GetCurrentScriptDirectory ~ "TW.png";
  let qwe = GetCurrentScriptDirectory ~ "supershot.txt";
 let cir = GetCurrentScriptDirectory ~ "circle.png";
 let cha = GetCurrentScriptDirectory ~ "ch.png";
 let spbg1 = GetCurrentScriptDirectory ~ "bg1.png";
 let spbg2 = GetCurrentScriptDirectory ~ "bg2.png";
 let name = GetCurrentScriptDirectory ~ "222.png";
 let name2 = GetCurrentScriptDirectory ~ "222.png";
  @Initialize {
  
  CreateAura01("RED",0,2);
   LoadUserShotData(qwe);
  
    SetLife(8000);
	SetTimer(50);
    SetDurableSpellCard;
    LoadGraphic(imgNue);
    LoadGraphic(name);
    LoadGraphic(name2);
    LoadGraphic(cir);
    LoadGraphic(cha);
    LoadGraphic(Cut);
    LoadGraphic(spbg1);
    LoadGraphic(spbg2);
    MagicCircle(false);
    InitializeAnimationData;
	inc;
 
  
  
    Animate("nue", "idle", true);
   mus;
    ShowOffNueAnimation;
   //cutin("NAZRIN", "",Cut,0,0,229,485); 
  }
  let po=0;
  let qwer=0;
  task mm{ loop{yield;
	SetMovePosition03(GetX,GetY-10,14,1);
		wait(30);
		SetMovePosition03(GetX,GetY+10,14,1);
		wait(30);
		
		
	
  }}
  let wai=120;
let angleb=0;let aa=0;
  task blasta{
  wait(240);wai=15;
  loop{
  
aa+=15;
   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
  loop(5){
  as+=72;
  CreateShot01(GetX+40*cos(as),GetY+40*sin(as),2.5,angleb+aa,32,10);
  angleb+=360/5;
  }
  wait(wai);
  
  }
  
  
  }
  let yyyy2=0;
  task inc{wait(110);
  loop(30){
  xxxx+=10;
  yield;
  }
  loop(60){
  xxxx+=1;
  yield;
  }
  
  loop(10){
  xxxx+=7;
  yield;
  }
   loop(54){yyyy2+=0.5;
  yyyy+=yyyy2;
  yield;
  }
  yyyy=-190;xxxx=GetCenterX+155;
    loop(5){
  yyyy+=1;
  yield;
  }
  
  
  
  
  }
  @MainLoop {SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
    yield ;
	if(po>1){
	if(GetPlayerY<GetY+150){SetPlayerY(GetY+150);}
		
	
		
	
  }
  
  
  
  
  
  
  if(po>30){po=29;
 mm;}
  
  
  
  
  
  
  
  }let wave=0;
  let x=0;let y=0;let z=0;let dir=60;let dor=60; let sa=0;let xxxx=0; let yyyy=0;let cds=0;
  @DrawLoop {
    
	  

	  
	 
	 
	  
	     SetTexture(cir);SetAlpha(150);
 
	SetGraphicRect(0,0,128,127);
	SetGraphicScale(2+sin(wave)*0.2,2+sin(wave)*0.2);

wave+=3;x+=3;
	SetGraphicAngle(0, 0, x);
	DrawGraphic(GetX,GetY);
	
	
	 SetTexture(cir);SetAlpha(90);
 
	SetGraphicRect(0,0,128,127);
	SetGraphicScale(2.3+sin(wave)*0.2,2.3+sin(wave)*0.2);


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


	SetGraphicAngle(0, 0, x);
	DrawGraphic(GetX,GetY);
	
   //////
   //GetX + dir*cos(dor), GetY + dir*sin(dor);
   

	
  
  
   
    SetTexture(imgNue);SetAlpha(255);SetGraphicScale(1.3,1.3);SetRenderState(ALPHA);
	  SetGraphicAngle(y, 0, 0);
    DrawAnimatedSprite("nue", GetX, GetY+5*sin(dor));
	
	    SetTexture(name);SetAlpha(250);
 
	SetGraphicRect(0,0,325,36);
	SetGraphicScale(1,1);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(xxxx-150,230+yyyy);
	
	
	 dor+=6;
    
	
	
  }let yyt=0;
  @BackGround{
  
  angle55+=yyt;
	
	
  
   
	
///	
	
	
	
	///
	
	  SetTexture(spbg2);SetAlpha(255);
 //SetRenderState(ADD);
	SetGraphicRect(0,0,384,448);
	SetGraphicScale(1.1+0.01*sin(dor),1.1+0.01*sin(dor));
//SetRenderState(ALPHA);

	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX,GetCenterY);
	
	
	
  
SetTexture(spbg1);SetAlpha(155);
	SetRenderState(ADD);
 SetColor(210,210,230);
	SetGraphicRect(0,0,256,256);
	SetGraphicScale(2,2);
SetGraphicAngle(0, 0, dor/10);

	
	DrawGraphic(GetCenterX,GetCenterY);
	
  z=z+2;
  }let as=0;
 task charge{
 PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 wait(60);
 }
  task mus{}
  @Finalize {
    DeleteGraphic(imgNue);
   
  }
  let ab=0;let ang=0;

 let choise=0;
	let choise2=0;
	let dx=0;
	let dy=0;
	let ds=0;
	
	let choise22=0;
	let choise222=0;
	let dx2=0;
	let dy2=0;
	let ds2=0;
	
	let choise223=0;
	let choise2223=0;
	let dx23=0;
	let dy23=0;
	let ds23=0;
	let qwer223=0;
	let sp23=0;
	////////////

let angle55=0;
let ae=0;let sp=0;let sp2=0;
let spd=0;




let angle2=0;

let sd2=0;







let dar=0;

let aq=0;



task spina{



loop(90){wait(5);


CreateShot01(GetX,GetY,1.8,aq,61,10);
CreateShot01(GetX,GetY,1.6,aq+45,62,10);
CreateShot01(GetX,GetY,1.4,aq+90,63,10);




aq+=19.7543;
}





}



  task ShowOffNueAnimation {
 PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_fault.wav");
let xc=60;

task fs{
loop{
yield;
if(cds==1){
PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 wait(60);
	 
	  wait(20);cds=0;

}

}

}
	Animate("nue", "spin", true);
	 SetMovePosition03(GetCenterX, GetCenterY-80, 20, 4);
	 fs;
      while(GetSpeed>0.1){yield;}
	  wait(20);
	  	Animate("nue", "idle", true);
	wait(90);
	Animate("nue", "spin", true);
     wait(20);
	 PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_cat00.wav");
	  cutin("NAZRIN", " Collecting Sign '' Hidden Misfortune '' ",Cut,0,0,256,512); 
	 // MotionBlurEx(ALL,180,50,ALPHA);
	   SetScore(30000);
	   
	  
	  
	wait(20);
	
	
	   wait(20);
	   Animate("nue", "idle", true);
	PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 wait(60);
	wait(60);let yyu=0;
	loop{yield;dar=0;
	
	if(yyu>0){
	wait(60); }
	
	Animate("nue", "spin", true);
	 spina;yyu=1;
	 loop(2){
	 dar+=1;
	 
	
	 
	 
	 loop(11){
	wait(5);
x2+=36;
	amu(GetClipMinX+x2-25,GetClipMaxY,1,123);
	 
	 }
	 
	 
	 x2=0;
	 
	 
	  loop(12){
	wait(5);
x2+=36;
	amu(GetClipMaxX-5,GetClipMaxY-x2+10,1,123);
	 
	 }

	 x2=0;
	 
	 loop(11){
	wait(5);
x2+=36;
	amu(GetClipMaxX-x2+25,GetClipMinY,1,123);
	 
	 }
	 
	 
	 x2=0;
	 
	  x2=0;
	 
	 
	
	 
	 
	 
	 
	  loop(12){
	wait(5);
x2+=36;
	amu(GetClipMinX+5,GetClipMinY+x2-10,1,123);
	 
	 }x2=0;
	 
	 
	 
	 if(dar==2){
	 
	  
	 Animate("nue", "idle", true);PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
	 wait(70);
	   
	  wait(60);
	  Animate("nue", "spin", false);
	 wait(20);
	  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_don00.wav");
	 
	 blasta;
	 Animate("nue", "idle", false);
	 
	 }
	 
	 let yuq=0;let as=0;let ad=0;
	 task blasta{
	 yield;qq;
	 loop(60){
	 CreateShot01(GetX,GetY,1,yuq+as,32,0);
	 CreateShot01(GetX,GetY,1.2,yuq+as+90,31,0);
	 yuq+=360/60;
	 }as+=19.8;
	 
	 loop(30){
	 

	 
	 
CreateShotA(21111,GetX,GetY,10);
   SetShotDataA(21111,0,1,yuq,2,0,0,150);
   SetShotDataA(21111,60,1,yuq,0.1,0,0,150);
 
FireShot(21111);

	 
CreateShotA(211111,GetX,GetY,10);
   SetShotDataA(211111,0,1,yuq,-2,0,0,150);
   SetShotDataA(211111,60,1,yuq,-0.1,0,0,150);
 
FireShot(211111);
	 
	 
	 
	 
	 	 
CreateShotA(21111,GetX,GetY,10);
   SetShotDataA(21111,0,1,yuq,2,0,0,150);
   SetShotDataA(21111,90,1,yuq,0.1,0,0,150);
 
FireShot(21111);

	 
CreateShotA(211111,GetX,GetY,10);
   SetShotDataA(211111,0,1,yuq,-2,0,0,150);
   SetShotDataA(211111,90,1,yuq,-0.1,0,0,150);
 
FireShot(211111);
	 
	 

	 
	 	 
CreateShotA(21111,GetX,GetY,10);
   SetShotDataA(21111,0,1,yuq,2,0,0,150);
   SetShotDataA(21111,120,1,yuq,0.1,0,0,150);
 
FireShot(21111);

	 
CreateShotA(211111,GetX,GetY,10);
   SetShotDataA(211111,0,1,yuq,-2,0,0,150);
   SetShotDataA(211111,120,1,yuq,-0.1,0,0,150);
 
FireShot(211111);
	 
	 
	 yuq+=360/30;
	 }as+=19.8;
	 
	 
	 ad=0;
	 loop(10){
	 ad+=0.2;
	 
	 CreateShot01(GetX,GetY,0.8+ad,90,229,0);
	 CreateShot01(GetX,GetY,0.8+ad,90+30,229,0);
	 CreateShot01(GetX,GetY,0.8+ad,90+60,229,0);
	 CreateShot01(GetX,GetY,0.8+ad,90+90,229,0);
	 CreateShot01(GetX,GetY,0.8+ad,90+120,229,0);
	 
	 

	 CreateShot01(GetX,GetY,0.8+ad,90-30,229,0);
	 CreateShot01(GetX,GetY,0.8+ad,90-60,229,0);
	 CreateShot01(GetX,GetY,0.8+ad,90-90,229,0);
	 CreateShot01(GetX,GetY,0.8+ad,90-120,229,0);
	 
	 
	 }
	 
	 
	 }
	 
	 
	 
	 
	 
	 
	 
	 
	}
  }Animate("nue", "idle", true);wait(60);}
  
  let x2=0;let angleg=0;
  let ob=0;let angla=0;
  
  
  
  function wait(t){
    loop(t){yield;}
  }
sub InitializeAnimationData {
 CreateAnimation("nue", "idle", 4);
    SetAnimationFrame("nue", "idle", 0, imgNue,38, 17, 3, 48, 62);
    SetAnimationFrame("nue", "idle", 1, imgNue,38, 81, 3, 112, 62);
    SetAnimationFrame("nue", "idle", 2, imgNue,38, 145, 3, 176, 62);
    SetAnimationFrame("nue", "idle", 3, imgNue,38, 209, 3, 240, 62);
  
   
    
    CreateAnimation("nue", "spin", 8);
  SetAnimationFrame("nue", "spin", 0, imgNue, 8, 17,68, 48, 125);
	SetAnimationFrame("nue", "spin", 1, imgNue, 8, 81,68, 112, 125);
	
	SetAnimationFrame("nue", "spin", 2, imgNue, 8, 145,68, 176, 125);
	SetAnimationFrame("nue", "spin", 3, imgNue, 8, 209,68, 240, 125);
	
	SetAnimationFrame("nue", "spin", 4, imgNue, 8, 16,131, 47, 187);
	
	SetAnimationFrame("nue", "spin", 5, imgNue, 8, 80,131, 111, 189);
	
	SetAnimationFrame("nue", "spin", 6, imgNue, 8, 144,131, 175, 188);
	SetAnimationFrame("nue", "spin", 7, imgNue, 8, 209,131, 240, 190);
    
	
   
   
    
   

  
  }
   task SetNueMoveAnimation(direction) {
    if(direction == "left"){
      Animate("nue", "start move left", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue", "stop move left", false);
    }
    if(direction == "right"){
      Animate("nue", "start move right", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue", "stop move right", false);
    }
    wait(12);
    Animate("nue", "idle", true);
  }
  let asd=0;
  let yy=0;
  
  //////////
  let yyy=0;
  
  task sped{
  
  }
  let as3=0;let as2=0;
  let as33=0;let as22=0;
  
  ////
  //
  //
  
  task amu(x,y,sp,gr){
 
 
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
  let obj288=Obj_Create(OBJ_SHOT);
	Obj_SetX(obj288,x);
	Obj_SetY(obj288,y);
	Obj_SetSpeed(obj288,0);
	
	
	Obj_SetAngle(obj288,atan2(GetY-Obj_GetY(obj288),GetX-Obj_GetX(obj288)));
	
	
	ObjShot_SetBombResist(obj288,true);
	ObjShot_SetGraphic(obj288,gr);
	ObjShot_SetDelay(obj288,15);
	Obj_SetAutoDelete(obj288,true);

	task delete{
	
	loop{
	yield;
	if(Obj_GetX(obj288)<GetX+5&&Obj_GetX(obj288)>GetX-5&&Obj_GetY(obj288)<GetY+5&&Obj_GetY(obj288)>GetY-5){
	
	
	Obj_Delete(obj288);
	
	}}
	
	
	
	}
	
	delete;
	while(!Obj_BeDeleted(obj288)){yield;
  loop(30){
  Obj_SetSpeed(obj288,Obj_GetSpeed(obj288)+0.18);
  wait(5);
  }break;
  
  }
  
  
  
  }
  
  
  
  
  
  
  
  
  task qq{
  
  
  
  task check{
  let ad=0;let ad2=0;
  loop{
  yield;
  
  if(Obj_GetY(obj2888)<GetClipMinY-15){
  
   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_don00.wav");
	
 
 
 
 
	 loop(11){ yield;
	wait(2);
x2+=16;
	lasarus(GetClipMaxX-x2+25);
	 
	 }
 yield;
 
 
 
 
 break;}
  
  
  
  
  }
  
  }
  
  

  
  let obj2888=Obj_Create(OBJ_SHOT);
	Obj_SetX(obj2888,GetX);
	Obj_SetY(obj2888,GetY);
	Obj_SetSpeed(obj2888,0.2);
	
	
	Obj_SetAngle(obj2888,270);
	
	
	ObjShot_SetBombResist(obj2888,true);
	ObjShot_SetGraphic(obj2888,210);
	ObjShot_SetDelay(obj2888,5);
	Obj_SetAutoDelete(obj2888,true);

	
	
	while(!Obj_BeDeleted(obj2888)){yield;
  
  check;
  
  loop(30){
  Obj_SetSpeed(obj2888,Obj_GetSpeed(obj2888)+0.1);
  wait(5);
  }
  
  break;
  
  
  
  }
  
  
  
  
  
  
  
}




task lasarus(x){




let obj = Obj_Create(OBJ_LASER);

    // initial settings
    Obj_SetPosition   (obj, x, GetClipMinY-10);
    Obj_SetAngle      (obj, 90+rand(30,-30));
    ObjLaser_SetWidth (obj, -4);
    ObjLaser_SetLength (obj, 600);
    ObjShot_SetGraphic(obj, 14);
    ObjLaser_SetSource(obj, false);
  
  let anglel=0;
  while(!Obj_BeDeleted(obj)){yield;
	Obj_SetAutoDelete(obj,true);

  
  
wait(60); 
 

PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_lazer01.wav");
  loop(10){yield;
 ObjLaser_SetWidth (obj, ObjLaser_GetWidth(obj)+2);
  
  }
  wait(60);
ObjShot_FadeDelete(obj);
  }





}



}

