script_enemy_main
{    
    let imgEnemy="script\DanMUku\Stage2\Image\Boo.png";
    let count=-100;
    let a=68;
    let b=100;
    let o =0;
    let bullet = [];
    let angle = 0;
    let tir = "script\DanMUku\Stage2\Son\tir.wav";
    let boo = "script\DanMUku\Stage2\Son\boo.wav";

   @Initialize
   {
      LoadGraphic(imgEnemy);
      LoadSE(tir);
            SetLife(100); 
   }
   
   @MainLoop
   {
if(count<27)
{
o+=2;
}
if(count==40)
{
PlaySE(boo);
a=0;
b=33;
loop(6)
{
PlaySE(tir);
Bullet(GetX, GetY, angle);
angle+=60;
}
}
if(count==80)
{
    let i = 0;
while (i < length(bullet))
{
   if (Obj_BeDeleted(bullet[i]))
   {
      bullet = erase(bullet, i);
      i--;
   }
   else
   {
      let obj = bullet[i];
      loop(6)
{
PlaySE(tir);
CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 2, angle, WHITE01, 0);
angle+=60;
}
Obj_Delete(obj);
   }
   i++;
}
}
if(count>200&&count<327)
{
a=68;
b=100;
o-=2;
}
if(count==328)
{
SetSpeed(10);
SetAngle(100);
}
count++;
yield;
   }
   @Finalize
   {
}
   
   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetAlpha(o);
            SetTexture(imgEnemy);
            SetGraphicRect(a, 0, b, 33);
            DrawGraphic(GetX,GetY);
   }

   task Bullet(x, y, angle) {
  let obj_id=Obj_Create(OBJ_SHOT);

     Obj_SetPosition(obj_id, x, y);
     Obj_SetAngle(obj_id, angle);
     Obj_SetSpeed(obj_id, 2);
     ObjShot_SetGraphic(obj_id, PURPLE01);
     ObjShot_SetDelay  (obj_id, 0);
     bullet = bullet ~ [obj_id];
     while(Obj_BeDeleted(obj_id)==false) {
             yield;
      }
}

}