#e
#Title[uł̒Łv]
#Text[G@Lugv]
#ScriptVersion[2]
#PlayLevel[Easy]
#Player[FREE]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "uł̒Łv";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetX(GetCenterX);
  SetY(GetCenterY - 120);
  SetLife(7000);
  SetScore(1000000);
  SetTimer(32);

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

  TMain;
 }

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

  SetMovePosition02(GetCenterX, GetCenterY + 180, 100);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  TShot;
  TRadius;
 }

 task TShot {
  yield;

  loop {
   loop(30) { yield; }
   CreateShot01(rand(GetClipMinX, GetCenterX - 4), GetClipMinY, rand(1, 2), 90, WHITE01, 0);
   CreateShot01(rand(GetCenterX + 4, GetClipMaxX), GetClipMinY, rand(1, 2), 90, WHITE01, 0);
   CreateShot01(rand(GetClipMinX, GetCenterX - 4), GetClipMaxY, rand(1, 2), -90, WHITE01, 0);
   CreateShot01(rand(GetCenterX + 4, GetClipMaxX), GetClipMaxY, rand(1, 2), -90, WHITE01, 0);
  }
 }

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

  loop {
   loop(1) { yield; }
   SetShotColor(1, 1, 1);
   CreateShot01(GetPlayerX + offsetX(100, x), GetPlayerY + offsetY(100, y), 0.05, atan2(GetPlayerY - (GetPlayerY + offsetY(100, y)), GetPlayerX - (GetPlayerX + offsetX(100, x))), WHITE11, 0);
   x += 5;
   y += 5;
  }
 }

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

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

}