respawn de nau i invulnerabilitat

This commit is contained in:
2025-12-10 11:35:45 +01:00
parent 9a5adcbcc5
commit 3b638f4715
5 changed files with 55 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ class Nau {
: renderer_(nullptr) {}
Nau(SDL_Renderer* renderer);
void inicialitzar(const Punt* spawn_point = nullptr);
void inicialitzar(const Punt* spawn_point = nullptr, bool activar_invulnerabilitat = false);
void processar_input(float delta_time);
void actualitzar(float delta_time);
void dibuixar() const;
@@ -27,6 +27,7 @@ class Nau {
float get_angle() const { return angle_; }
bool esta_viva() const { return !esta_tocada_; }
bool esta_tocada() const { return esta_tocada_; }
bool es_invulnerable() const { return invulnerable_timer_ > 0.0f; }
const std::shared_ptr<Graphics::Shape>& get_forma() const { return forma_; }
float get_brightness() const { return brightness_; }
Punt get_velocitat_vector() const {
@@ -54,7 +55,8 @@ class Nau {
float angle_; // Angle d'orientació
float velocitat_; // Velocitat (px/s)
bool esta_tocada_;
float brightness_; // Factor de brillantor (0.0-1.0)
float brightness_; // Factor de brillantor (0.0-1.0)
float invulnerable_timer_; // 0.0f = vulnerable, >0.0f = invulnerable
void aplicar_fisica(float delta_time);
};