Afegit outline al text 2x

corregit el marcador durant el Player::State::RECOVER
This commit is contained in:
2025-08-24 14:37:30 +02:00
parent 32e9da55ef
commit 74f6fe3501
8 changed files with 72 additions and 74 deletions

View File

@@ -624,6 +624,9 @@ void Player::setPlayingState(State state) {
switch (playing_state_) {
case State::RECOVER: {
score_ = 0; // Pon los puntos a cero para que no se vea en el marcador
score_multiplier_ = 1.0F;
setScoreboardMode(Scoreboard::Mode::SCORE);
break;
}
case State::RESPAWNING: {
@@ -781,19 +784,19 @@ void Player::updateInvulnerable() {
if (playing_state_ == State::PLAYING && invulnerable_) {
if (invulnerable_counter_ > 0) {
--invulnerable_counter_;
// Frecuencia fija de parpadeo (como el original)
constexpr int blink_speed = 8;
// Calcula proporción decreciente: menos textura blanca hacia el final
// Al inicio: 50-50, hacia el final: 70-30 (menos blanco)
float progress = 1.0f - (static_cast<float>(invulnerable_counter_) / INVULNERABLE_COUNTER);
int white_frames = static_cast<int>((0.5f - progress * 0.2f) * blink_speed);
int white_frames = static_cast<int>((0.5f - progress * 0.2f) * blink_speed);
// Alterna entre texturas con proporción variable
bool should_show_invulnerable = (invulnerable_counter_ % blink_speed) < white_frames;
size_t target_texture = should_show_invulnerable ? INVULNERABLE_TEXTURE : coffees_;
// Solo cambia textura si es diferente (optimización)
if (player_sprite_->getActiveTexture() != target_texture) {
player_sprite_->setActiveTexture(target_texture);