#東方弾幕風
#Title[復活「ゴールデンバレット-Lunatic-」]
#Text[仮]
#ScriptVersion[2]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "復活「ゴールデンバレット」";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetX(GetCenterX);
  SetY(GetCenterY - 120);
  SetLife(5000);
  PlaySE(spellSE);

  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;
 }

 task TShot {
  let id = 1;
  let x = rand(GetClipMinX, GetClipMaxX);
  let y = rand(GetClipMinY, GetClipMaxY);
  let xStairs = 0;
  let yStairs = 0;
  let slip = 0;
  let delay = 120;
  yield;

  loop {
   CreateLaserC(2, x + 100, y + 10, 10, 200, RED11, 60);
   SetLaserDataC(2, 0, 2, 180, 0, 0, 2);
   FireShot(2);
   CreateShotA(3, x + 100, y + 10, 60);
   SetShotDataA(3, 0, 1, 180, 0, 0, 2, RED03);
   FireShot(3);
   CreateLaserC(2, x - 100, y + 10, 10, 200, RED11, 60);
   SetLaserDataC(2, 0, 2, -90, 0, 0, 2);
   FireShot(2);
   CreateShotA(3, x - 100, y + 10, 60);
   SetShotDataA(3, 0, 1, -90, 0, 0, 2, RED03);
   FireShot(3);
   CreateLaserC(2, x - 100, y - 200, 10, 200, RED11, 60);
   SetLaserDataC(2, 0, 2, 0, 0, 0, 2);
   FireShot(2);
   CreateShotA(3, x - 100, y - 200, 60);
   SetShotDataA(3, 0, 1, 0, 0, 0, 2, RED03);
   FireShot(3);
   CreateLaserC(2, x + 100, y - 200, 10, 200, RED11, 60);
   SetLaserDataC(2, 0, 2, 90, 0, 0, 2);
   FireShot(2);
   CreateShotA(3, x + 100, y - 200, 60);
   SetShotDataA(3, 0, 1, 90, 0, 0, 2, RED03);
   FireShot(3);

   loop(120) { yield; }

   loop(4) {
    loop(20) {
     CreateShotA(id, x - xStairs + slip + 100, y - yStairs, delay);
     SetShotDataA(id, 0, 0, 0, 0, 0, 0, YELLOW02);
     SetShotDataA(id, 60, 1, rand(0, 360), 0, 0, 1, YELLOW01);
     FireShot(id);
     xStairs += 10;
     yStairs += 10;
     yield;
    }
    xStairs = 0;
    yStairs = 0;
    slip += 12.5;
    yield;
   }

   loop(4) {
    loop(20) {
     CreateShotA(id, x + xStairs + slip - 200, y - yStairs, delay);
     SetShotDataA(id, 0, 0, 0, 0, 0, 0, YELLOW02);
     SetShotDataA(id, 60, 1, rand(0, 360), 0, 0, 1, YELLOW01);
     FireShot(id);
     xStairs += 10;
     yStairs += 10;
     yield;
    }
    xStairs = 0;
    yStairs = 0;
    slip += 12.5;
    yield;
   }

   CreateShot01(x + 100, y + 10, 1, atan2(GetPlayerY - (y + 10), GetPlayerX - (x + 100)), YELLOW03, 60);
   CreateShot01(x - 100, y + 10, 1, atan2(GetPlayerY - (y + 10), GetPlayerX - (x - 100)), YELLOW03, 60);
   CreateShot01(x - 100, y - 200, 1, atan2(GetPlayerY - (y - 200), GetPlayerX - (x - 100)), YELLOW03, 60);
   CreateShot01(x + 100, y - 200, 1, atan2(GetPlayerY - (y - 200), GetPlayerX - (x + 100)), YELLOW03, 60);
   CreateShot01(x, y + 10, 1, atan2(GetPlayerY - (y + 10), GetPlayerX - x), YELLOW03, 60);
   CreateShot01(x - 100, y - 100, 1, atan2(GetPlayerY - (y - 100), GetPlayerX - (x - 100)), YELLOW03, 60);
   CreateShot01(x, y - 200, 1, atan2(GetPlayerY - (y - 200), GetPlayerX - x), YELLOW03, 60);
   CreateShot01(x + 100, y - 100, 1, atan2(GetPlayerY - (y - 100), GetPlayerX - (x + 100)), YELLOW03, 60);

   x = rand(GetClipMinX + 130, GetClipMaxX - 50);
   y = rand(GetClipMinY + 150, GetClipMaxY);
   slip = 0;
   loop(40) { yield; }
  }
 }

#include_function ".\変数集.txt"
}