#pragma once #include // para shared_ptr #include "animated_sprite.h" // para SpriteAnimated class Texture; // Clase SpriteSmart class SmartSprite : public AnimatedSprite { private: // Variables bool on_destination_ = false; // Indica si está en el destino int dest_x_ = 0; // Posicion de destino en el eje X int dest_y_ = 0; // Posicion de destino en el eje Y int finished_counter_ = 0; // Contador para deshabilitarlo bool finished_ = false; // Indica si ya ha terminado bool enabled_ = false; // Indica si el objeto está habilitado // Comprueba si ha terminado void checkFinished(); // Comprueba el movimiento void checkMove(); public: // Constructor explicit SmartSprite(std::shared_ptr texture) : AnimatedSprite(texture) {} // Destructor ~SmartSprite() = default; // Actualiza la posición y comprueba si ha llegado a su destino void update() override; // Dibuja el sprite void render() override; // Getters int getDestX() const { return dest_x_; } int getDestY() const { return dest_y_; } bool isOnDestination() const { return on_destination_; } bool hasFinished() const { return finished_; } // Setters void setFinishedCounter(int value) { finished_counter_ = value; } void setDestX(int x) { dest_x_ = x; } void setDestY(int y) { dest_y_ = y; } void setEnabled(bool value) { enabled_ = value; } };