コード例 #1
0
ファイル: missile.cpp プロジェクト: lluixhi/nxengine-evo
void ai_missile_boom_spawner(Object *o)
{
        if ((++o->timer % 3) != 1)
                return;

        if (o->state == 0) {
                o->state = 1;
                o->timer = 0;

                o->xmark = o->x;
                o->ymark = o->y;

                // give us the same bounding box as the boomflash effects
                o->sprite = SPR_BOOMFLASH;
                o->invisible = true;
        }

        int range = o->shot.boomspawner.range;
        o->x = o->xmark + (random(-range, range) << CSF);
        o->y = o->ymark + (random(-range, range) << CSF);

        effect(o->x, o->y, EFFECT_BOOMFLASH);
        missilehitsmoke(o);

        damage_all_enemies_in_bb(o, FLAG_INVULNERABLE);

        if (--o->shot.boomspawner.booms_left <= 0)
                o->Delete();
}
コード例 #2
0
ファイル: missile.cpp プロジェクト: isage/nxengine-evo
void ai_missile_boom_spawner(Object *o)
{

  if (o->state == 0)
  {
    o->state = 1;
    o->timer = 0;

    o->xmark = o->x;
    o->ymark = o->y;

    // give us the same bounding box as the boomflash effects
    o->sprite    = SPR_BOOMFLASH;
    o->invisible = true;
  }

  if (!(o->shot.boomspawner.booms_left % 3))
  {
    int range = 0;
    switch (o->shot.level)
    {
      case 1:
        range = 16;
        break;
      case 2:
        range = 32;
        break;
      case 3:
        range = 40;
        break;
    }
    int x = o->CenterX() + (random(-range, range) * CSFI);
    int y = o->CenterY() + (random(-range, range) * CSFI);

    effect(x, y, EFFECT_BOOMFLASH);
    missilehitsmoke(x, y, o->shot.boomspawner.range);
  }

  if (--o->shot.boomspawner.booms_left < 0)
    o->Delete();
}