From 7b24bfae942b1a578c486e0ae22453d3293dee01 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 21 May 2026 10:27:56 +0200 Subject: [PATCH] =?UTF-8?q?feat(enemy):=20parpadeig=20dorat=20quan=20est?= =?UTF-8?q?=C3=A0=20herit=20(Fase=204)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enemy::draw() ara, si wounded_timer_ > 0, alterna entre el color del tipus i Defaults::Palette::WOUNDED (dorat) a Wounded::BLINK_HZ usant fmod sobre el periode del cicle — patró reutilitzat del Ship::draw() d'invulnerabilitat però aplicat a color en lloc de visibilitat. A 10 Hz amb DURATION=1s dóna ~10 parpadeigs visibles abans d'explotar. Co-Authored-By: Claude Opus 4.7 (1M context) --- source/game/entities/enemy.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/game/entities/enemy.cpp b/source/game/entities/enemy.cpp index 7766297..d531a12 100644 --- a/source/game/entities/enemy.cpp +++ b/source/game/entities/enemy.cpp @@ -245,6 +245,17 @@ void Enemy::draw() const { color = Defaults::Palette::MOLINILLO; break; } + + // Parpadeo dorado mientras está herido: alterna color de tipo ↔ dorado + // a Wounded::BLINK_HZ usando el timer (fmod sobre el periodo). + if (wounded_timer_ > 0.0F) { + const float CYCLE = 1.0F / Defaults::Enemies::Wounded::BLINK_HZ; + const float T = std::fmod(wounded_timer_, CYCLE); + if (T < (CYCLE / 2.0F)) { + color = Defaults::Palette::WOUNDED; + } + } + Rendering::renderShape(renderer_, shape_, center_, rotacio_, SCALE, 1.0F, brightness_, color); }