From f14a1075abda91289a9f34fdaf39f11e5f79abb1 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 28 Oct 2025 11:02:22 +0100 Subject: [PATCH] migrat Enemy a time based --- source/game/entities/enemy.cpp | 4 ++-- source/game/entities/enemy.hpp | 2 +- source/game/gameplay/room.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/game/entities/enemy.cpp b/source/game/entities/enemy.cpp index 35ca6bd..9f69cd9 100644 --- a/source/game/entities/enemy.cpp +++ b/source/game/entities/enemy.cpp @@ -44,8 +44,8 @@ void Enemy::render() { } // Actualiza las variables del objeto -void Enemy::update() { - sprite_->update(); +void Enemy::update(float delta_time) { + sprite_->update(delta_time); checkPath(); collider_ = getRect(); } diff --git a/source/game/entities/enemy.hpp b/source/game/entities/enemy.hpp index 6c0e4f7..5bd2d75 100644 --- a/source/game/entities/enemy.hpp +++ b/source/game/entities/enemy.hpp @@ -56,7 +56,7 @@ class Enemy { void render(); // Actualiza las variables del objeto - void update(); + void update(float delta_time); // Devuelve el rectangulo que contiene al enemigo auto getRect() -> SDL_FRect; diff --git a/source/game/gameplay/room.cpp b/source/game/gameplay/room.cpp index 7439969..7a9a209 100644 --- a/source/game/gameplay/room.cpp +++ b/source/game/gameplay/room.cpp @@ -485,7 +485,7 @@ void Room::update(float delta_time) { for (const auto& enemy : enemies_) { // Actualiza los enemigos - enemy->update(); + enemy->update(delta_time); } for (const auto& item : items_) {