Exemplo n.º 1
0
/**
 * @brief Constructor.
 * @param map The map containing the entity.
 * @param index Index of the entity in the map.
 */
Crystal::Crystal(MapModel& map, const EntityIndex& index) :
  EntityModel(map, index, EntityType::CRYSTAL) {

  set_origin(QPoint(8, 13));

  DrawSpriteInfo info;
  info.sprite_id = "entities/crystal";
  set_draw_sprite_info(info);
}
Exemplo n.º 2
0
/**
 * @brief Updates the representation of the pickable.
 *
 * This function should be called when the treasure changes.
 */
void Pickable::update_treasure() {

  QString treasure_name = get_field("treasure_name").toString();
  int treasure_variant = get_field("treasure_variant").toInt();
  if (!treasure_name.isEmpty()) {
    DrawSpriteInfo info;
    info.sprite_id = "entities/items";
    info.animation = treasure_name;
    info.direction = treasure_variant - 1;
    set_draw_sprite_info(info);
  }
}