#e
#Title[1uCv]
#Text[䕗݂ȍUłB͂􂪁cc
Ƃ܂Ȃ̂ŉs\]
#ScriptVersion[2]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let angle = 90;
 let pet = 0;

 function nway(dir, way, span, color) {
  let radius = 38;
  let mid = dir - (way - 1) / 2 * span;

  loop(way) {
   let x = GetX + offsetX(radius, mid);
   let y = GetY + offsetY(radius, mid);

   CreateShot01(x, y, 1.5, mid, color, 0);
   mid += span;
  }
 }

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

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

 @Initialize {
  SetX(GetCenterX);
  SetY(GetClipMinY + 120);
  SetLife(100000);
  SetTimer(60);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(0, 0, 63, 63);
 }

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

  pet += 1;
  if(pet == 6) {
   nway(angle, 8, 16, RED02);
   angle += 8;
  }
  else if(pet == 7) {
   nway(angle, 30, 29, BLUE22);
   angle += 13;
  }
  else if(pet == 9) {
   nway(angle, 5, 35, GREEN31);
   angle += 17.5;
   pet = 0;
  }
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

}