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

script_enemy_main {
  #include_function ".\AnimationLib.dnh"
  #include_function ".\Halo.txt"
  let imgNue = GetCurrentScriptDirectory ~ "su.png";
  let cir = GetCurrentScriptDirectory ~ "circle.png";
  let arr = GetCurrentScriptDirectory ~ "arrow.png";
  
  let qwe = GetCurrentScriptDirectory ~ "supershot.txt";
 let a=0;
  @Initialize {
  
  //CreateAura01("AZURE",0,2);
   LoadUserShotData(qwe);
    SetLife(2500);
    //SetY(-120);
    LoadGraphic(imgNue);
    LoadGraphic(cir);
    LoadGraphic(arr);
    PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\boss.mp3");
    InitializeAnimationData;
	SetTimer(99);
  
    Animate("nue", "idle", true);
   mus;
    ShowOffNueAnimation;
    
  }let aq=0;
  let aaaa=0;
  let anglet=0;
  let anglet2=0;
  
  @MainLoop {
  
  SetCollisionA(GetX,GetY,10);
  SetCollisionB(GetX,GetY,10);
    yield ;
  }
  let wave=0;
  let x=0;
  let h=0;
  @DrawLoop {
     
	 
	 
	 SetTexture(arr);SetAlpha(a);
 SetGraphicRect(0,0,600,600);
	
	SetGraphicScale(0.07,0.07);


	SetGraphicAngle(0, 0, 270);
	DrawGraphic(GetPlayerX,GetPlayerY-60);
     
  
	 
	 
	 
   
  SetTexture(imgNue);SetAlpha(255);
 SetGraphicRect(0,0,0,0);
	
	SetGraphicScale(1,1);


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

   h+=4;
  }
  
  task mus{PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\Nue1.mp3");}
  @Finalize {
    DeleteGraphic(imgNue);
   
  }
  let angle=270;let sp=3;let a=0;let angle2=0;
 
  task ShowOffNueAnimation {
  
CreateEventFromScript("test");
    wait(60);
	SetMovePosition03(GetCenterX, GetClipMinY+rand(80, 120), 20, 6);
      SetNueMoveAnimation("right");
      yield ;
      while(GetSpeed>0.1){yield;}
wait(32);
      Animate("nue", "idle", true);

SetCommonData("clear",0);
loop{yield;
if(GetEventStep==3){
CreateEnemyFromScript("fam1",GetX-300,GetY-40,0,0,0);
break;
}

}

//se_hint00.wav
loop(1700){yield;
if(GetEventStep==4){
a=255;PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_bonus2.wav"); 
wait(30);
a=0;


CreateEventFromScript("test2");
//wait(666);
break;
}
}

loop{yield;
if(GetCommonData("clear")==1){
SetLife(0);
}
}



	  
  }
  
  
  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);
  }
  
  function wait(t){
    loop(t){yield;}
  }
  
  sub InitializeAnimationData {
    CreateAnimation("nue", "idle", 4);
    SetAnimationFrame("nue", "idle", 0, imgNue, 13, 15, 2, 48, 61);
   
    SetAnimationFrame("nue", "idle", 1, imgNue, 13, 79, 3, 112, 61);
    SetAnimationFrame("nue", "idle", 2, imgNue, 13, 143, 3, 176, 61);
    SetAnimationFrame("nue", "idle", 3, imgNue, 13, 207, 3, 240, 61);
	
    
    
	
	
    CreateAnimation("nue", "start move right", 4);
    SetAnimationFrame("nue", "start move right", 0, imgNue, 8, 13, 65, 50, 124);
    SetAnimationFrame("nue", "start move right", 1, imgNue, 8, 74, 65, 114, 123);
    SetAnimationFrame("nue", "start move right", 2, imgNue, 8, 137, 66, 178, 122);
    SetAnimationFrame("nue", "start move right", 3, imgNue, 8, 197, 66, 242, 123);
   
    
    CreateAnimation("nue", "stop move right", 4);
    SetAnimationFrame("nue", "stop move right", 0,  imgNue, 8, 197, 66, 242, 123);
    SetAnimationFrame("nue", "stop move right", 1, imgNue, 8, 137, 66, 178, 122);
    SetAnimationFrame("nue", "stop move right", 2, imgNue, 8,  74, 65, 114, 123);
    SetAnimationFrame("nue", "stop move right", 3, imgNue, 8, 13, 65, 50, 124);
   
    
	
	
	
    CreateAnimation("nue", "start move left", 2);
    SetAnimationFrame("nue", "start move left", 0, imgNue, 8, 308, 132, 382, 253);
    SetAnimationFrame("nue", "start move left", 1, imgNue, 8, 228, 134, 301, 258);
   
    
    CreateAnimation("nue", "stop move left", 2);
    SetAnimationFrame("nue", "stop move left", 0,imgNue, 8, 228, 134, 301, 258);
    SetAnimationFrame("nue", "stop move left", 1,imgNue, 8, 308, 132, 382, 253);
   
    
    CreateAnimation("nue", "start cast", 2);
    SetAnimationFrame("nue", "start cast", 0, imgNue, 6, 0,125,73,247);
    SetAnimationFrame("nue", "start cast", 1, imgNue, 6, 79,129,153,250);
   
    
    CreateAnimation("nue", "stop cast",2);
    SetAnimationFrame("nue", "stop cast", 0, imgNue, 6, 79,129,153,250);
    SetAnimationFrame("nue", "stop cast", 1, imgNue, 6,0,125,73,247);
    
  }
}




script_enemy fam1{let fi=0;
 #include_function ".\AnimationLib.dnh"
    let gr = GetCurrentScriptDirectory ~ "circle.png";
  let dir=0;
  let r=80;
   let imgNue = GetCurrentScriptDirectory ~ "sa.png";
  @Initialize{
  SetLife(2000);InitializeAnimationData;
  LoadGraphic(imgNue);
  LoadGraphic(gr);
 //  Animate("nue", "idle", true);
  main;
  }
  SetCommonData("sanae",0);
  @MainLoop{yield;
  
  }let h=0;
  @DrawLoop{
  
  
  SetTexture(imgNue);SetAlpha(255);
 SetGraphicRect(0,0,0,0);
	
	SetGraphicScale(1,1);


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

   h+=4;
  
  }
  @Finalize{
  
  }
  let angle=0;
  task main{
  Animate("nue", "start move right", false);
 SetMovePosition03(GetCenterX-40, GetClipMinY+rand(80, 120), 20, 2);
      SetNueMoveAnimation("right");
      yield ;
      while(GetSpeed>0.1){yield;}
wait(120);
      Animate("nue", "idle", true);

	
  loop{
  yield;
  if(GetCommonData("sanae")==1){
  a=180;
 Animate("nue", "start move left", false);
 
SetMovePosition03(GetCenterX-340, GetClipMinY+130, 20, 5);
wait(60);
VanishEnemy;
}
  }
  }
  
  
  task df{
  loop{yield;wait(5);
if(GetEventStep==6){
 Animate("nue", "start move left", true);
SetMovePosition03(GetCenterX-340, GetClipMinY+rand(80, 120), 20, 4);
wait(60);
VanishEnemy;
}
}
  }
  
  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);
  }
  
  function wait(t){
    loop(t){yield;}
  }
  let a=0;
  sub InitializeAnimationData {
    CreateAnimation("nue", "idle", 4);
    SetAnimationFrame("nue", "idle", 0, imgNue, 13, 15, 2, 48, 61);
   
    SetAnimationFrame("nue", "idle", 1, imgNue, 13, 79, 3, 112, 61);
    SetAnimationFrame("nue", "idle", 2, imgNue, 13, 143, 3, 176, 61);
    SetAnimationFrame("nue", "idle", 3, imgNue, 13, 207, 3, 240, 61);
	
    
    
	
	
    CreateAnimation("nue", "start move right", 2);
    SetAnimationFrame("nue", "start move right", 0, imgNue, 8, 228, 1, 301, 123);
    SetAnimationFrame("nue", "start move right", 1, imgNue, 8, 308, 5, 381, 128);
   
    
    CreateAnimation("nue", "stop move right", 2);
    SetAnimationFrame("nue", "stop move right", 0, imgNue, 8, 308, 5, 381, 128);
    SetAnimationFrame("nue", "stop move right", 1, imgNue, 8, 228, 1, 301, 123);
   
    
	
	
	
    CreateAnimation("nue", "start move left", 4);
    SetAnimationFrame("nue", "start move left", 0, imgNue, 8, 9, 69, 46, 120);
    SetAnimationFrame("nue", "start move left", 1, imgNue, 8, 68, 68, 110, 117);
    SetAnimationFrame("nue", "start move left", 2, imgNue, 8, 129, 70, 177, 118);
    SetAnimationFrame("nue", "start move left", 3, imgNue, 8, 191, 73, 243, 118);
   
    
    CreateAnimation("nue", "stop move left", 2);
    SetAnimationFrame("nue", "stop move left", 0,imgNue, 8, 228, 134, 301, 258);
    SetAnimationFrame("nue", "stop move left", 1,imgNue, 8, 308, 132, 382, 253);
   
    
    CreateAnimation("nue", "start cast", 2);
    SetAnimationFrame("nue", "start cast", 0, imgNue, 6, 0,125,73,247);
    SetAnimationFrame("nue", "start cast", 1, imgNue, 6, 79,129,153,250);
   
    
    CreateAnimation("nue", "stop cast",2);
    SetAnimationFrame("nue", "stop cast", 0, imgNue, 6, 79,129,153,250);
    SetAnimationFrame("nue", "stop cast", 1, imgNue, 6,0,125,73,247);
    
  }
  
  
  
  }
  
  
  
  
  
  









script_event test {
 function wait(n) {loop(n){yield;} }
    let CSD = GetCurrentScriptDirectory;
    let su = CSD ~ ".\suf.png";
    let suw = CSD ~ ".\sufwtf.png";
    let suh = CSD ~ ".\sufh.png";
    let sac = CSD ~ ".\safc.png";
    let sas = CSD ~ ".\safs.png";
    let saa = CSD ~ ".\safa.png";
    let sau = CSD ~ ".\safu.png";
    let saw = CSD ~ ".\safw.png";
    let sa = CSD ~ ".\saf.png";
 
@Initialize {
        LoadGraphic(su);
        LoadGraphic(suw);
        LoadGraphic(suh);
        LoadGraphic(sac);
        LoadGraphic(sa);
		
        LoadGraphic(sas);
        LoadGraphic(saa);
        LoadGraphic(sau);
        LoadGraphic(saw);
 //SetTexture(imgReimu);
		
 }
 
@MainLoop{

TextOutA("Oh."); 

SetChar(RIGHT, suw); 
SetGraphicRect(RIGHT, 0, 0, 256, 256);  
MoveChar(RIGHT, FRONT); 
TextOutA("I feel kinda wierd.."); 
TextOutA("SANAE!"); 

MoveChar(RIGHT, BACK);



  SetStep(3);
  
  wait(120);
  
  
  

SetChar(LEFT, saw); 
SetGraphicRect(LEFT, 0, 0, 256, 256);  
MoveChar(LEFT, FRONT); 
TextOutA("Did you notice that too?!"); 


MoveChar(LEFT, BACK);


  
SetChar(RIGHT, su); 
SetGraphicRect(RIGHT, 0, 0, 256, 256);  
MoveChar(RIGHT, FRONT); 
TextOutA("What a strange feeleing.."); 
TextOutA("What do you think about that?"); 

MoveChar(RIGHT, BACK);

  
  
  
  
SetChar(LEFT, sa); 
SetGraphicRect(LEFT, 0, 0, 256, 256);  
MoveChar(LEFT, FRONT); 
TextOutA("Well.."); 

TextOutA("I feel strange aura coming from this   person."); 


MoveChar(LEFT, BACK);
  
  
  SetStep(4);
  
 End;           //This ends the event.

  
 
 
 }}
	
	

script_event test2 {
 function wait(n) {loop(n){yield;} }
    let CSD = GetCurrentScriptDirectory;
    let su = CSD ~ ".\suf.png";
    let suw = CSD ~ ".\sufwtf.png";
    let suh = CSD ~ ".\sufh.png";
    let sac = CSD ~ ".\safc.png";
    let sas = CSD ~ ".\safs.png";
    let saa = CSD ~ ".\safa.png";
    let sau = CSD ~ ".\safu.png";
    let saw = CSD ~ ".\safw.png";
    let sa = CSD ~ ".\saf.png";
 
@Initialize {
        LoadGraphic(su);
        LoadGraphic(suw);
        LoadGraphic(suh);
        LoadGraphic(sac);
        LoadGraphic(sa);
		
        LoadGraphic(sas);
        LoadGraphic(saa);
        LoadGraphic(sau);
        LoadGraphic(saw);
 //SetTexture(imgReimu);
		
 }
 
@MainLoop{



SetChar(RIGHT, su); 
SetGraphicRect(RIGHT, 0, 0, 256, 256);  
MoveChar(RIGHT, FRONT); 
TextOutA("So.."); 
SetChar(RIGHT, suw); 
TextOutA("We need to test you."); 
TextOutA("And make sure that it isn't your fault."); 
TextOutA("That's right?"); 

MoveChar(RIGHT, BACK);



  
  
  wait(120);
  
  
  

SetChar(LEFT, sas); 
SetGraphicRect(LEFT, 0, 0, 256, 256);  
MoveChar(LEFT, FRONT); 
TextOutA("Yes,that's right."); 


MoveChar(LEFT, BACK);


  
SetChar(RIGHT, su); 
SetGraphicRect(RIGHT, 0, 0, 256, 256);  
MoveChar(RIGHT, FRONT); 
TextOutA("Oh,it's just wonderful."); 
SetChar(RIGHT, suh); 
TextOutA("It's time for another Festival!"); 

MoveChar(RIGHT, BACK);

  SetCommonData("sanae",1);
  
  
  
SetChar(LEFT, sa); 
SetGraphicRect(LEFT, 0, 0, 256, 256);  
MoveChar(LEFT, FRONT); 
TextOutA("Got it."); 


MoveChar(LEFT, BACK);
DeleteGraphic(sa);

  
 
SetChar(RIGHT, su); 
SetGraphicRect(RIGHT, 0, 0, 256, 256);  
MoveChar(RIGHT, FRONT); 
TextOutA("So be it."); 
SetChar(RIGHT, suh); 
TextOutA("I hope you'll enjoy this Festival!"); 

MoveChar(RIGHT, BACK);

 SetCommonData("clear",1);
 End;           //This ends the event.

 
 
 
 }}
		