
#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 tri11 = GetCurrentScriptDirectory ~ "tri1.png";
  let tri22 = GetCurrentScriptDirectory ~ "tri2.png";
  let arr = GetCurrentScriptDirectory ~ "arrow.png";
  SetCommonData("clear",0);
  let qwe = GetCurrentScriptDirectory ~ "supershot.txt";
 let a=0;
  @Initialize {
  SetY(-555);
  //CreateAura01("AZURE",0,2);
   LoadUserShotData(qwe);
    SetLife(2500);
    //SetY(-120);
 LoadGraphic(tri11);
 LoadGraphic(tri22);
    
    InitializeAnimationData;
	SetTimer(99);
  
    Animate("nue", "idle", true);
   mus;
   //tri1;
   
   ds;
   wait(9999);

   CreateEventFromScript("test");
    
  }let aq=0;
  let aaaa=0;
  let anglet=0;
  let anglet2=0;
  
  @MainLoop {
  if(GetCommonData("clear")==2){DeleteMusic(GetCurrentScriptDirectory ~ ".\Sounds\xxx.mp3");VanishEnemy;}
  SetCollisionA(GetX,GetY,10);
  SetCollisionB(GetX,GetY,10);
    yield ;
  }
  let wave=0;
  let x=0;
  let h=0;
  
  
  
  
  
  
  task ds{
  
  
  
  loop{
  
  yield;
  if(GetCommonData("clear")==1){CreateEnemyFromScript("fam2",GetClipMaxX+100,GetClipMaxY+80,0,0,0); break;}
  }
  
  }
  
  
  
  
  
  
  
  
  @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 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_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 sud = CSD ~ ".\sud.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(sud);
        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("I lost?"); 

SetChar(RIGHT, sud); 
TextOutA("Oh well.."); 


MoveChar(RIGHT, BACK);







SetChar(LEFT, saw); 
SetGraphicRect(LEFT, 0, 0, 256, 256);  
MoveChar(LEFT, FRONT); 
TextOutA("Suwako-sama!"); 
SetChar(LEFT, sa); 
TextOutA("This person is not responsible for this!"); 
MoveChar(LEFT, BACK);






SetChar(RIGHT, su); 
SetGraphicRect(RIGHT, 0, 0, 256, 256);  
MoveChar(RIGHT, FRONT); 
TextOutA("Are you sure?"); 
MoveChar(RIGHT, BACK);



MoveChar(LEFT, FRONT);
SetChar(LEFT, sa );

TextOutA("Absolutely.I understood it recently."); 

SetChar(LEFT, sau );
TextOutA("My apologies.."); 
MoveChar(LEFT, BACK);



SetChar(RIGHT, su); 
SetGraphicRect(RIGHT, 0, 0, 256, 256);  
MoveChar(RIGHT, FRONT); 
TextOutA("Then who is responsible for that?"); 
MoveChar(RIGHT, BACK);



MoveChar(LEFT, FRONT);
SetChar(LEFT, sau );

TextOutA("I don't really know.."); 

SetChar(LEFT, sac );
TextOutA("It is a mystery!"); 
MoveChar(LEFT, BACK);




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

  
 
 
 }}
	
	
	
	
	
	
	
	
	

script_enemy fam2{let fi=0;
    let tri11 = GetCurrentScriptDirectory ~ "tri1.png";
  let tri22 = GetCurrentScriptDirectory ~ "tri2.png";
  @Initialize{
  SetLife(21000);
 tri1;
  main;
  
  PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\xxx.mp3");
  
  
  }
  @MainLoop{yield;
  
  }
  @DrawLoop{
  
	

  }
  @Finalize{
  
  }
  let angle=0;
  task main{
  d=1;
    SetMovePosition03(GetX, GetY-920, 1,1);
   wait(600);
   SetCommonData("clear",2);
 
 
 
}
  
  
  let a=0;
  let b=0;
  let c=0;
  let d=0;
   function wait(t){
    loop(t){yield;}
  }
  
  
  
  
  
  
  
  
  
  
  
  task tri1{
  
  
  
  
  
  
 
    let objid = Obj_Create(OBJ_EFFECT);
          Obj_SetX(objid, GetX);
          Obj_SetY(objid, GetY);
          ObjEffect_SetLayer(objid, 8);
          ObjEffect_SetScale(objid,1,0.5);
          ObjEffect_SetAngle(objid, 0,0,0);
		  
	
		  
		  
 Obj_SetAlpha(objid,0);
 
 
 
 
 
 
          // Set the object's texture
          ObjEffect_SetTexture(objid, tri22);
 
          // Set the primitive type (here, we use a simple triangle list)
          ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
 
          // Create the vertex list (3 vertices - just one triangle)
          ObjEffect_CreateVertex(objid, 4);
		  
		  
		  
		  
		  
		  //251/259
		  //////////125/129
 
         //ordinates and texture coordinates for the first vertex (number 0)
          ObjEffect_SetVertexXY(objid, 0, -80, -129);
          ObjEffect_SetVertexUV(objid, 0, 0, 0);
 
        //
          ObjEffect_SetVertexXY(objid, 1, 80, -129);
          ObjEffect_SetVertexUV(objid, 1, 251, 0);
 
        //
          ObjEffect_SetVertexXY(objid, 2, -80, 129);
          ObjEffect_SetVertexUV(objid, 2, 0, 259);
		 //
		   ObjEffect_SetVertexXY(objid, 3, 80, 129);
          ObjEffect_SetVertexUV(objid, 3, 251, 259);
		 
		 
		 //Obj_SetAlpha(objid,0);
		 
		 
		 
		 dsa;
		 
		 
		 
		 task dsa{
		 loop{
		 a+=d;
		 b+=d;
		 c+=d;
		 yield;ObjEffect_SetAngle(objid, a,b,c);
		  Obj_SetX(objid, GetX);
          Obj_SetY(objid, GetY);
		 
		}

 
 
 
 
 }
  
  
  
  
  
  
  
  
  
  }
  
  }
  












	
	

