refactor(defaults): centralitza init hud, tips, hit timer, line thickness i debug overlay
This commit is contained in:
@@ -107,8 +107,8 @@ GameScene::GameScene(SDLManager& sdl, SceneContext& context)
|
||||
} else {
|
||||
// Jugador inactiu: marcar como a mort permanent
|
||||
ships_[i].markHit();
|
||||
hit_timer_per_player_[i] = 999.0F; // Valor sentinella (permanent inactiu)
|
||||
lives_per_player_[i] = 0; // Sin vides
|
||||
hit_timer_per_player_[i] = Defaults::Game::HIT_TIMER_INACTIVE_PLAYER;
|
||||
lives_per_player_[i] = 0; // Sin vides
|
||||
std::cout << "[GameScene] Jugador " << (i + 1) << " inactiu\n";
|
||||
}
|
||||
}
|
||||
@@ -628,8 +628,9 @@ void GameScene::tocado(uint8_t player_id) {
|
||||
const Vec2& ship_pos = ships_[player_id].getCenter();
|
||||
float ship_angle = ships_[player_id].getAngle();
|
||||
Vec2 vel_nau = ships_[player_id].getVelocityVector();
|
||||
// Reduir a 80% la velocity heretada per la ship (més realista)
|
||||
Vec2 vel_nau_80 = {.x = vel_nau.x * 0.8F, .y = vel_nau.y * 0.8F};
|
||||
// Reduir la velocity heretada per la ship segons defaults (més realista)
|
||||
constexpr float INHERIT = Defaults::Physics::Debris::SHIP_VELOCITY_INHERITANCE;
|
||||
Vec2 vel_nau_80 = {.x = vel_nau.x * INHERIT, .y = vel_nau.y * INHERIT};
|
||||
|
||||
debris_manager_.explode(
|
||||
ships_[player_id].getShape(), // Ship shape (3 lines)
|
||||
@@ -646,7 +647,7 @@ void GameScene::tocado(uint8_t player_id) {
|
||||
);
|
||||
|
||||
// Start death timer (non-zero to avoid re-triggering)
|
||||
hit_timer_per_player_[player_id] = 0.001F;
|
||||
hit_timer_per_player_[player_id] = Defaults::Game::HIT_TIMER_TRIGGER_DEATH;
|
||||
}
|
||||
// Phase 2 is automatic (debris updates in update())
|
||||
// Phase 3 is handled in update() when hit_timer_per_player_ >= DEATH_DURATION
|
||||
@@ -828,8 +829,8 @@ void GameScene::fireBullet(uint8_t player_id) {
|
||||
const Vec2& ship_centre = ships_[player_id].getCenter();
|
||||
float ship_angle = ships_[player_id].getAngle();
|
||||
|
||||
constexpr float LOCAL_TIP_X = 0.0F;
|
||||
constexpr float LOCAL_TIP_Y = -12.0F;
|
||||
constexpr float LOCAL_TIP_X = Defaults::Hud::Tips::LOCAL_X;
|
||||
constexpr float LOCAL_TIP_Y = Defaults::Hud::Tips::LOCAL_Y;
|
||||
float cos_a = std::cos(ship_angle);
|
||||
float sin_a = std::sin(ship_angle);
|
||||
float tip_x = (LOCAL_TIP_X * cos_a) - (LOCAL_TIP_Y * sin_a) + ship_centre.x;
|
||||
|
||||
Reference in New Issue
Block a user