示例#1
0
/**
 * @brief Draws the entity on the map.
 */
void Door::draw_on_map() {

  if (!is_drawn()) {
    return;
  }

  if (has_sprite() && !is_open()) {
    Detector::draw_on_map();
  }
}
示例#2
0
/**
 * \copydoc MapEntity::notify_direction_changed
 */
void Stream::notify_direction_changed() {

  Detector::notify_direction_changed();

  // Give the correct direction to the sprite if any.
  int direction8 = get_direction();
  if (has_sprite()
      && get_sprite().get_nb_directions() >= 8) {
    // There is a sprite with all necessary directions.
    get_sprite().set_current_direction(direction8);
  }
}
示例#3
0
/**
 * \brief When the enemy is killed, returns whether the dying animation is finished.
 * \return true if the dying animation is finished
 */
bool Enemy::is_dying_animation_finished() const {

  if (nb_explosions > 0 && !exploding) {
    return true;
  }

  if (has_sprite()) {
    return get_sprite().is_animation_finished();
  }

  return false;
}
示例#4
0
/**
 * \brief When the enemy is killed, returns whether the dying animation is finished.
 * \return true if the dying animation is finished
 */
bool Enemy::is_dying_animation_finished() const {

  if (!is_dying()) {
    // The enemy is still alive.
    return false;
  }

  if (nb_explosions > 0) {
    // The dying animation is some explosions.
    return !exploding;
  }

  if (has_sprite()) {
    // The dying animation is the usual "enemy_killed" sprite.
    return get_sprite().is_animation_finished();
  }

  // There is no dying animation (case of holes, water and lava for now).
  return true;
}