/** * \brief Plays the animation destroy of this item. */ void Destructible::play_destroy_animation() { is_being_cut = true; modified_ground = GROUND_EMPTY; Sound::play(get_destruction_sound_id()); get_sprite().set_current_animation("destroy"); if (!is_drawn_in_y_order()) { get_entities().bring_to_front(this); // show animation destroy to front } update_ground_observers(); // The ground (if any) has just disappeared. }
/** * \brief Plays the animation destroy of this item. */ void Destructible::play_destroy_animation() { is_being_cut = true; if (!destruction_sound_id.empty()) { Sound::play(destruction_sound_id); } get_sprite().set_current_animation("destroy"); if (!is_drawn_in_y_order()) { get_entities().bring_to_front(*this); // Show animation destroy to front. } update_ground_observers(); // The ground (if any) has just disappeared. }
/** * \brief Changes the ground defined by this entity. * \param modified_ground The new ground to set, or Ground::EMPTY to clear it. */ void CustomEntity::set_modified_ground(Ground modified_ground) { if (modified_ground == this->modified_ground) { return; } // The ground changes, notify observers even if it changes to Ground::EMPTY. ground_modifier = true; this->modified_ground = modified_ground; update_ground_observers(); // Now, continue notifications only if not Ground::EMPTY. bool ground_modifier = modified_ground != Ground::EMPTY; if (ground_modifier != this->ground_modifier) { this->ground_modifier = ground_modifier; get_entities().notify_entity_ground_modifier_changed(*this); } }