#e
#Title[ufBAiNCG-Nomal-v]
#Text[G@́up`[Em[bWv]
#ScriptVersion[2]
#PlayLevel[Nomal]
#Player[FREE]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "ufBAiNCG-Nomal-v";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetX(GetCenterX);
  SetY(GetCenterY);
  SetLife(9000);
  SetScore(1000000);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);

  TMain;
 }

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

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  TShot;
  TLaser;
 }

 task TShot {
  let x = 0;
  let y = 0;
  yield;

  loop {
   loop(8) { yield; }
   CreateShotA(1, GetX + offsetX(60, x), GetY + offsetY(60, y), 0);
   SetShotDataA(1, 0, 0, atan2(GetY - (GetY + offsetY(60, y)), GetX - (GetX + offsetX(60, x))), 0, 0, 0, BLUE11);
   SetShotDataA(1, 180, 0.3, NULL, 0, 0, 0.3, BLUE11);
   SetShotDataA(1, 900, 0.1, NULL, 0, 0, 0.1, BLUE11);
   SetShotDataA(1, 1200, 0.01, NULL, 0, 0, 0.01, BLUE11);
   SetShotDataA(1, 2000, 10, NULL, 0, 0, 10, RED03);
   FireShot(1);
   x += 15.5;
   y += 15.5;
  }
 }

 task TLaser {
  yield;

  loop {
   loop(25) { yield; }
   CreateLaser01(GetX, GetY, rand(0.3, 0.5), rand(0, 360), 100, 5, RED11, 0);
  }
 }

 function offsetX(radius, mid) {
  return radius * cos(mid);
 }

 function offsetY(radius, mid) {
  return radius * sin(mid);
 }

}