script_enemy_main {
  #include_function ".\lib\enemy.dnh"
  #include_function ".\lib\fairy_animation.dnh"
  @Initialize {
    InitializeEnemy;
    InitializeFairyAnimation(imgBlueFairy);
    SetLife(350);
    Attack;
  }
  
  @MainLoop {
    if(Spawned){
      SetCollisionA(GetX, GetY, 16);
      SetCollisionB(GetX, GetY, 12);
    }
    yield;
  }
  
  @DrawLoop {
    if(Spawned){
      DrawFairy;
    }
  }
  
  @Finalize {
    FinalizeEnemy;
  }
  
  task Attack {
    while(!Spawned){ yield; }
    loop {
      Spread(rand(0, 360));
      Wait(120);
    }
    
    task Spread(angle) {
      loop(3){
        PlaySE(sfxShot1);
        ascent(i in 0..6){
          WrapObjShot_Initialize(GetX, GetY, 3, i*60+angle, 60, 10, 240);
        }
        Wait(7);
      }
    }
  }
}