#東方弾幕風
#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(4000);
  SetScore(600000);
  SetMovePosition02(GetCenterX, GetCenterY, 1000);
  boss_magic_circle;
  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);
  PlaySE(spellSE);
  SetInvincibility(180);
  PlaySE(powerSE);
  Concentration01(180);
  
  TMain;
 }

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

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  loop(50) {
   CreateItem(ITEM_SCORE, rand(GetX - 50, GetX + 50), rand(GetY - 50, GetY + 50));
  }
  DeleteGraphic(img);
 }

 task TMain {
  yield;
  wait(180);
  TShot;
 }

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

  loop {
   loop(10) { yield; }
   PlaySE(iceSE);
   CreateShot01(GetPlayerX + offsetX(radius, x), GetPlayerY + offsetY(radius, y), 1, atan2(GetPlayerY - (GetPlayerY + offsetY(radius, y)), GetPlayerX - (GetPlayerX + offsetX(radius, x))), BLUE21, 50);
   x = rand(0, 360);
   y = rand(0, 360);
  }
 }

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

 function offsetY(radius, mid) {
  return radius * sin(mid);
 }
#include_function ".\変数集.txt"
#include_function ".\functions.txt"
}