
#Title[カメレオンスティングS]
#Text[某カメレオンの特殊武器]
#ScriptVersion[2]
script_enemy_main {
  let imgBoss = "script\ザコ\zako4.PNG";
  let frame   = 0;
  let xIni    = GetCenterX;
  let yIni    = GetClipMaxY - 400;
  let angle   = 90;
  let name    = "カメレオンスティング";
@Initialize {

    SetLife(1000);
    SetDamageRate(100, 100);
              SetScore(GetLife/2+GetLife/2*GetPlayerLife);
    SetTimer(20);
    LoadGraphic(imgBoss);
   SetTexture(imgBoss);   SetGraphicRect(0, 0, 63, 63);
    TMain;

   }
@MainLoop {
             SetScore(500+500*GetPlayerLife);
    SetCollisionA(GetX, GetY, 0);
    SetCollisionB(GetX, GetY, 0);
   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;
standBy;
loop
{
move;
aro;
wait(60);

}

}


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

 sub move{
    yield;
 SetColor(0,255,26);
 Concentration01(30);
 SetColor(255,255,255);
        loop(30) { yield; }
             SetMovePosition02(
                     rand(GetClipMinX + 90, GetClipMaxX - 90),
                     rand(GetClipMaxY - 300, GetClipMinY + 60),60);
          }
       
    function wait(w) {
        loop(w) { yield; }
                    }
 sub aro{   let an=GetAngleToPlayer;
 CreateLaserC(359,GetX,GetY,20,30,GREEN21,0);
SetLaserDataC(359,1,12,an,0,0,0);

let aa=1;

FireShot(359);

}
 

}
