This commit is contained in:
2025-10-27 11:53:12 +01:00
parent 231dcd4b3b
commit 5d8811026d
69 changed files with 899 additions and 888 deletions

View File

@@ -25,7 +25,7 @@ Enemy::Enemy(const EnemyData& enemy)
sprite_->setWidth(enemy.w);
sprite_->setHeight(enemy.h);
const SDL_FlipMode FLIP = (should_flip_ && enemy.vx < 0.0f) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
const SDL_FlipMode FLIP = (should_flip_ && enemy.vx < 0.0F) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
const SDL_FlipMode MIRROR = should_mirror_ ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE;
sprite_->setFlip(static_cast<SDL_FlipMode>(FLIP | MIRROR));

View File

@@ -5,12 +5,12 @@
// Constructor
Item::Item(ItemData item)
: sprite_(std::make_shared<SurfaceSprite>(Resource::get()->getSurface(item.tile_set_file), item.x, item.y, ITEM_SIZE_, ITEM_SIZE_)),
change_color_speed(4) {
: sprite_(std::make_shared<SurfaceSprite>(Resource::get()->getSurface(item.tile_set_file), item.x, item.y, ITEM_SIZE, ITEM_SIZE)),
change_color_speed_(4) {
// Inicia variables
sprite_->setClip((item.tile % 10) * ITEM_SIZE_, (item.tile / 10) * ITEM_SIZE_, ITEM_SIZE_, ITEM_SIZE_);
sprite_->setClip((item.tile % 10) * ITEM_SIZE, (item.tile / 10) * ITEM_SIZE, ITEM_SIZE, ITEM_SIZE);
collider_ = sprite_->getRect();
counter_ = item.counter * change_color_speed;
counter_ = item.counter * change_color_speed_;
// Inicializa los colores
color_.push_back(item.color1);
@@ -22,7 +22,7 @@ Item::Item(ItemData item)
// Pinta el objeto en pantalla
void Item::render() {
const int INDEX = (counter_ / change_color_speed) % color_.size();
const int INDEX = (counter_ / change_color_speed_) % color_.size();
sprite_->render(1, color_.at(INDEX));
}

View File

@@ -29,7 +29,7 @@ struct ItemData {
class Item {
private:
// Constantes
static constexpr float ITEM_SIZE_ = 8;
static constexpr float ITEM_SIZE = 8;
// Objetos y punteros
std::shared_ptr<SurfaceSprite> sprite_; // SSprite del objeto
@@ -38,7 +38,7 @@ class Item {
std::vector<Uint8> color_; // Vector con los colores del objeto
int counter_; // Contador interno
SDL_FRect collider_; // Rectangulo de colisión
int change_color_speed; // Cuanto mas alto, mas tarda en cambiar de color
int change_color_speed_; // Cuanto mas alto, mas tarda en cambiar de color
public:
// Constructor