
#Title[儔僾僞乕僟僀僽S]
#Text[朸戦偺抏枊]
#ScriptVersion[2]

script_enemy_main {
  let imgBoss = "script\朸榟\dotwasi.png";
  let frame   = 0;
  let xIni    = GetCenterX;
  let yIni    = GetClipMaxY - 300;
  let angle   = 90;
  let angle2   = 90;
let X=GetX;
let Y=GetY;
  let name = "儔僾僞乕僟僀僽";
@Initialize {

    SetLife(250);
    SetDamageRate(10, 10);
    SetTimer(60);
SetShotAutoDeleteClip(128,128,128,128);
    LoadGraphic(imgBoss);
LoadUserShotData(".\塇.txt");
SetGraphicRect(  0,   0,  64,  128);
   SetTexture(imgBoss);   

    setGraphicMove;
    TMain;

   }
@MainLoop {
    SetCollisionA(GetX, GetY, 24);
    SetCollisionB(GetX, GetY, 24);
   yield;

}
@DrawLoop{
    DrawGraphic(GetX, GetY);
   }

@Finalize {
    DeleteGraphic(imgBoss);}

function moveToPlayer(xMove, yAdd, frame, left, top, right, bottom) {
     let x;
     let y;

     if(GetPlayerX < GetX) {
         x = GetX - xMove;
         if(x < left) {
             x = GetX + xMove;
     }
     } else {
         x = GetX + xMove;
         if(right < x) {
             x = GetX - xMove;
         }
     }
     y = GetY + yAdd;
     if(y < top) {
         y = top;
     } else if(bottom > y) {
         y = bottom;
     }

     SetMovePosition02(x, y, frame);



}

  task TMain {

         yield;

angle=125;
SetMovePosition01(GetClipMinX-60,GetClipMaxY+60,16);
setGraphicPose2;
loop(30){Y=GetY;X=GetX+80;wait(2.5);shot2;}
VanishEnemy;
    }


    sub standBy{
            let wIni =60;
        SetMovePosition02(xIni, yIni, wIni);
    SetInvincibility(wIni);
   wait(wIni);  
             }

  task move{loop{
  


        loop(60) { yield; }
       moveToPlayer(rand(0, 60), rand(-30, 20), 60,
                     GetClipMinX + 60, GetClipMinY + 32,
                     GetClipMaxX - 60, GetClipMinY + 60);}
       }
    function wait(w) {
        loop(w) { yield; }
                    }
 task shot{
    yield;
let CX=X;
let CY=Y;
let sc=90;
angle=0;
loop(10){

CreateShotA(3,CX,CY,0);
angle=angle+180;
SetShotDataA(3,0,10,90,7,0,9,BLUE12);
SetShotDataA(3,sc,0,angle+135,0,0.1,3,BLUE31);
FireShot(3);
wait(5);
sc=sc-5;

}}
 task shot2{
    yield;
let CX=X;
let CY=Y;
let sc=90;
angle=0;
loop(10){

CreateShotA(3,CX,CY,0);
angle=angle+180;
SetShotDataA(3,0,10,90,7,0,9,PURPLE12);
SetShotDataA(3,sc,0,angle+45,0,0.2,6,PURPLE31);

FireShot(3);
wait(5);
sc=sc-5;

}
}
 task shot3{
    yield;
let CX=X;
let CY=Y;
let sc=90;
angle=0;
loop(2){
CreateShotA(3,GetX,GetY,0);
SetShotDataA(3,0,3,GetAngleToPlayer,0,0,5,AQUA04);
FireShot(3);
}

}






    sub setGraphicStop  { SetGraphicRect(  0,   0,  64,  128); }
    task setGraphicPose  {loop(180){ SetGraphicRect( 0,  128, 128,  256);yield;} }
    task setGraphicPose2{loop(120){ SetGraphicAngle(0,0,0); SetGraphicRect(  64*2,   128*1,  64*4,  128*2);yield;} }
    sub setGraphicRight  {SetGraphicAngle(180,0,0); SetGraphicRect(  64*1,   128*0,  64*2,  128*1); }
    sub setGraphicLeft {SetGraphicAngle(0,0,0); SetGraphicRect(  64*1,   128*0,  64*2,  128*1); }

    task setGraphicMove {
     loop{yield;
     SetGraphicAngle(0,0,0); SetGraphicRect(  64*2,   128*1,  64*4,  128*2);
         }
    }
}