弾幕風で自機狙いやN-way弾を撃つ

                                                    <p>雑ですので注意を<br />#東方弾幕風<br />#Title[自機狙い弾を絶えず撃つ]<br />#Text[]<br />#ScriptVersion[2]</p>

script_enemy_main {
  let imgExRumia = GetCurrentScriptDirectory ~ "imgExRumia.png";

  @Initialize {
    SetMovePosition02(GetCenterX, GetClipMinY + 60, 60);
    SetLife(3000);

    LoadGraphic(imgExRumia);
    SetTexture(imgExRumia);
    SetGraphicRect(1, 1, 64, 64);

    mainTask;
  }

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

  @DrawLoop {
    SetColor(255,255,255);
    SetRenderState(ALPHA);
    SetTexture(imgExRumia);
    if(GetSpeedX == 0) {
      SetGraphicRect(64, 1, 127, 64);
    } else if(GetSpeedX > 0) {
      SetGraphicRect(192, 1, 255, 64);
    } else if(GetSpeedX < 0) {
      SetGraphicRect(128, 1, 191, 64);
    }
    DrawGraphic(GetX, GetY);
  }

  @Finalize  {
    DeleteGraphic(imgExRumia);
  }

  task mainTask {
    loop(60) {yield;}

    loop {
      CreateShot01(GetX, GetY, 2, GetAngleToPlayer, RED01, 0);
      loop(60) {yield;}
    }
  }
}
GetAngleToPlayerとは,敵から見た自機の角度のこと。

#東方弾幕風
#Title[自機狙いN-way]
#Text[]
#BackGround[Default]
#ScriptVersion[2]

script_enemy_main {
  let imgExRumia = GetCurrentScriptDirectory ~ "imgExRumia.png";

  @Initialize {
    SetMovePosition02(GetCenterX, GetClipMinY + 60, 60);
    SetLife(3000);

    LoadGraphic(imgExRumia);
    SetTexture(imgExRumia);
    SetGraphicRect(1, 1, 64, 64);

    mainTask;
  }

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

  @DrawLoop {
    SetColor(255,255,255);
    SetRenderState(ALPHA);
    SetTexture(imgExRumia);
    if(GetSpeedX == 0) {
      SetGraphicRect(64, 1, 127, 64);
    } else if(GetSpeedX > 0) {
      SetGraphicRect(192, 1, 255, 64);
    } else if(GetSpeedX < 0) {
      SetGraphicRect(128, 1, 191, 64);
    }
    DrawGraphic(GetX, GetY);
  }

  @Finalize  {
    DeleteGraphic(imgExRumia);
  }

  task mainTask {
    loop(60) {yield;}
let wideAngle=37;   
 loop {
      let angle;
      angle = GetAngleToPlayer;
  
 let wayAngle = 0;
let way=5;
   wayAngle = wideAngle / ( way - 1 );
  angle -= wideAngle / 2;
      loop(way) {
 CreateShot01(GetX, GetY, 2, angle, RED01, 0);
angle += wayAngle;
      }
      loop(60) {yield;}
    }
  }
}

ポイント

  • ↑のようにすると角度いじりがやりやすい
  • 全方位にすることが可能