
#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;
  @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 try=0;
task vroom3{


wait(1500);
loop{
PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_exattack.wav");
loop(10){

 
CreateShotA(1111,GetX,GetY,10);
   SetShotDataA(1111,0,1,try,-3,0,0,30);
   SetShotDataA(1111,30,0,NULL,0,0,0,30);
   SetShotDataA(1111,230,0.1,NULL,0.2,0,0,31);
   SetShotDataA(1111,250,0.2,NULL,0.2,0,0,31);
   SetShotDataA(1111,270,0.3,NULL,0.2,0,0,31);
   SetShotDataA(1111,290,0.4,NULL,0.2,0,0,31);
   SetShotDataA(1111,310,0.5,NULL,0.2,0,0,31);
   SetShotDataA(1111,330,0.6,NULL,0.2,0,0,31);
   SetShotDataA(1111,350,0.7,NULL,0.2,0,0,31);
   SetShotDataA(1111,370,0.8,NULL,0.2,0,0,31);
FireShot(1111);

try+=360/10




}sd2=0;sd+=34.667;
wait(35);
}

}


task vroom2{


wait(1030);
loop{
PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_kira00.wav");
loop(10){
sd2+=0.1;
CreateShot01(GetX,GetY,0.6+sd2,45+sd,19,0);
CreateShot01(GetX,GetY,0.6+sd2,45+120+sd,19,0);
CreateShot01(GetX,GetY,0.6+sd2,45+120+120+sd,19,0);
}sd2=0;sd+=34.667;
wait(60);
}


}

let sd=0;

let yt=0;let angle=0;
task vroom{

wait(500);
loop{
PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan00.wav");
loop(8){
 
CreateShotA(111,GetX,GetY,0);
   SetShotDataA(111,0,2,angle+yt,-0,0,0,228);
   SetShotDataA(111,30,0.5,NULL,-0,0,0,228);
 
 
 
 
FireShot(111);


angle+=360/8;
}yt+=12.844567;
wait(60);


}


}



task firesd{

ae=1;
loop{
wait(3);
PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");


 
CreateShotA(11,GetX,GetY,10);
   SetShotDataA(11,0,0,GetAngle,-0,0,0,28);
   SetShotDataA(11,60,0.1,NULL,-0,0,0,28);
   SetShotDataA(11,60+20,0.2,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20,0.3,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20,0.4,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20+20,0.5,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20+20+20,0.6,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20+20+20+20,0.7,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20+20+20+20+20,0.8,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20+20+20+20+20+20,0.9,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20+20+20+20+20+20+20,1,NULL,-0,0,0,28);
   SetShotDataA(11,60+20+20+20+20+20+20+20+20+20+20,1.1,NULL,-0,0,0,28);
 angle2+=0.1;
FireShot(11);

}


}









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


	Animate("nue", "spin", true);
	 SetMovePosition03(GetCenterX, GetCenterY-90, 20, 4);
	 
      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", "Misfortune Sign '' Overflowing Misfortune '' ",Cut,0,0,256,512); 
	 // MotionBlurEx(ALL,180,50,ALPHA);
	   SetScore(30000);
	   
	  
	  
	wait(20);
	
	
	   wait(20);
	   Animate("nue", "idle", true);
	 
	  wait(20);
		PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 Concentration02(30);
 Concentration02(40);
 wait(60);
	 
	  wait(40);
 
	Animate("nue", "spin", true);
	firesd;
	
	vroom;
	vroom2;
	vroom3;
	
	loop(500){yield;

  
  SetMovePosition03(GetCenterX-ds*cos(dir),GetCenterY-120-ds*sin(dir),15,23);
  dir+=3;
  ds++;
  
  
  
  }
	
	loop{yield;
	
loop(1000){yield;

  
  SetMovePosition03(GetCenterX-ds*cos(dir),GetCenterY-120-ds*sin(dir),15,23);
  dir+=3;
  ds--;
  
  
  
  }
  
  
loop(1000){yield;

  
  SetMovePosition03(GetCenterX-ds*cos(dir),GetCenterY-120-ds*sin(dir),15,23);
  dir+=3;
  ds++;
  
  
  
  }
	
  
  
  
  }
	
	
	
  }
  
  
  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);
  }
  
  
  
}

