Implementadas las animaciones en el jugador

This commit is contained in:
2022-08-13 12:14:31 +02:00
parent e85f138be5
commit a1eaf8af07
7 changed files with 68 additions and 74 deletions

View File

@@ -24,16 +24,17 @@ private:
int counter; // Contador para las animaciones
};
std::vector<t_animation> animation; // Vector con las diferentes animaciones
int currentAnimation; // Animacion activa
public:
// Constructor
AnimatedSprite(LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr);
AnimatedSprite(LTexture *texture = nullptr, SDL_Renderer *renderer = nullptr, std::string file="");
// Destructor
~AnimatedSprite();
// Calcula el frame correspondiente a la animación
void animate(std::string name);
// Calcula el frame correspondiente a la animación actual
void animate();
// Establece el frame actual de la animación
void setCurrentFrame(std::string name, int num);
@@ -61,6 +62,12 @@ public:
// Carga la animación desde un fichero
bool load(std::string filePath);
// Establece la animacion actual
void setCurrentAnimation(std::string name);
// Actualiza las variables del objeto
void update();
};
#endif