mostra les rutes dels enemics al editor

This commit is contained in:
2026-04-02 10:36:41 +02:00
parent a2caf95005
commit 606388227c
9 changed files with 96 additions and 13 deletions

View File

@@ -48,6 +48,13 @@ void Enemy::update(float delta_time) {
collider_ = getRect();
}
#ifdef _DEBUG
// Solo actualiza la animación sin mover al enemigo
void Enemy::updateAnimation(float delta_time) {
sprite_->animate(delta_time);
}
#endif
// Comprueba si ha llegado al limite del recorrido para darse media vuelta
void Enemy::checkPath() { // NOLINT(readability-make-member-function-const)
if (sprite_->getPosX() > x2_ || sprite_->getPosX() < x1_) {

View File

@@ -29,6 +29,9 @@ class Enemy {
void render(); // Pinta el enemigo en pantalla
void update(float delta_time); // Actualiza las variables del objeto
#ifdef _DEBUG
void updateAnimation(float delta_time); // Solo actualiza la animación sin mover al enemigo
#endif
auto getRect() -> SDL_FRect; // Devuelve el rectangulo que contiene al enemigo
auto getCollider() -> SDL_FRect&; // Obtiene el rectangulo de colision del enemigo