revisió de capçaleres
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <memory> // Para shared_ptr, unique_ptr
|
||||
#include "sprite.h" // Para Sprite
|
||||
#include "utils.h" // Para Circle
|
||||
class Texture; // lines 8-8
|
||||
class Texture;
|
||||
|
||||
// Tipos de balas
|
||||
enum class BulletType : Uint8
|
||||
@@ -25,6 +25,23 @@ enum class BulletMoveStatus : Uint8
|
||||
// Clase Bullet
|
||||
class Bullet
|
||||
{
|
||||
public:
|
||||
// Constructor y Destructor
|
||||
Bullet(float x, float y, BulletType bullet_type, bool powered_up, int owner, std::shared_ptr<Texture> texture);
|
||||
~Bullet() = default;
|
||||
|
||||
// Métodos principales
|
||||
void render(); // Dibuja la bala en pantalla
|
||||
BulletMoveStatus move(); // Mueve la bala y devuelve su estado
|
||||
|
||||
// Estado de la bala
|
||||
bool isEnabled() const; // Comprueba si está activa
|
||||
void disable(); // Desactiva la bala
|
||||
|
||||
// Getters
|
||||
int getOwner() const; // Devuelve el identificador del dueño
|
||||
Circle &getCollider(); // Devuelve el círculo de colisión
|
||||
|
||||
private:
|
||||
// Constantes
|
||||
static constexpr float BULLET_WIDTH_ = 12.0f;
|
||||
@@ -33,39 +50,18 @@ private:
|
||||
static constexpr float BULLET_VEL_X_LEFT_ = -2.0f;
|
||||
static constexpr float BULLET_VEL_X_RIGHT_ = 2.0f;
|
||||
|
||||
std::unique_ptr<Sprite> sprite_; // Sprite con los gráficos y métodos de pintado
|
||||
// Propiedades
|
||||
std::unique_ptr<Sprite> sprite_; // Sprite con los gráficos
|
||||
|
||||
float pos_x_; // Posición en el eje X
|
||||
float pos_y_; // Posición en el eje Y
|
||||
float vel_x_; // Velocidad en el eje X
|
||||
|
||||
BulletType bullet_type_; // Tipo de objeto
|
||||
int owner_; // Identificador del dueño del objeto
|
||||
Circle collider_; // Círculo de colisión del objeto
|
||||
BulletType bullet_type_; // Tipo de bala
|
||||
int owner_; // Identificador del dueño
|
||||
Circle collider_; // Círculo de colisión
|
||||
|
||||
void shiftColliders(); // Alinea el círculo de colisión con el objeto
|
||||
void shiftSprite(); // Alinea el sprite con el objeto
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Bullet(float x, float y, BulletType bullet_type, bool powered_up, int owner, std::shared_ptr<Texture> texture);
|
||||
|
||||
// Destructor
|
||||
~Bullet() = default;
|
||||
|
||||
// Pinta el objeto en pantalla
|
||||
void render();
|
||||
|
||||
// Actualiza la posición y estado del objeto
|
||||
BulletMoveStatus move();
|
||||
|
||||
// Comprueba si el objeto está habilitado
|
||||
bool isEnabled() const;
|
||||
|
||||
// Deshabilita el objeto
|
||||
void disable();
|
||||
|
||||
// Obtiene parámetros
|
||||
int getOwner() const;
|
||||
Circle &getCollider();
|
||||
// Métodos internos
|
||||
void shiftColliders(); // Ajusta el círculo de colisión
|
||||
void shiftSprite(); // Ajusta el sprite
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user