[DOC:29/10/2025] la surface ara se pillarà del .ANI

Tots els arxius .ani i .room retocats per a adequarse als canvis.
This commit is contained in:
2025-10-29 14:22:36 +01:00
parent 95dd6b4f70
commit 70d6cbfaf8
134 changed files with 133 additions and 620 deletions

View File

@@ -10,7 +10,8 @@
// Constructor
Enemy::Enemy(const Data& enemy)
: sprite_(std::make_shared<SurfaceAnimatedSprite>(Resource::get()->getSurface(enemy.surface_path), Resource::get()->getAnimations(enemy.animation_path))),
// [DOC:29/10/2025] la surface ara se pillarà del .ANI
: sprite_(std::make_shared<SurfaceAnimatedSprite>(/*Resource::get()->getSurface(enemy.surface_path), */Resource::get()->getAnimations(enemy.animation_path))),
color_string_(enemy.color),
x1_(enemy.x1),
x2_(enemy.x2),

View File

@@ -10,7 +10,9 @@ class Enemy {
public:
// --- Estructuras ---
struct Data {
/* [DOC:29/10/2025] la surface ara se pillarà del .ANI
std::string surface_path{}; // Ruta al fichero con la textura
[/DOC] */
std::string animation_path{}; // Ruta al fichero con la animación
/* [DOC:29/10/2025] w i h ja no fan falta, se pilla del .ANI
int w = 0; // Anchura del enemigo

View File

@@ -18,7 +18,7 @@
Player::Player(const Data& player)
: room_(player.room) {
// Inicializa algunas variables
initSprite(player.texture_path, player.animations_path);
initSprite(/*player.texture_path, */player.animations_path);
setColor();
applySpawnValues(player.spawn_data);
placeSprite();
@@ -641,11 +641,11 @@ void Player::applySpawnValues(const SpawnData& spawn) {
}
// Inicializa el sprite del jugador
void Player::initSprite(const std::string& surface_path, const std::string& animations_path) {
auto surface = Resource::get()->getSurface(surface_path);
void Player::initSprite(/*const std::string& surface_path, */const std::string& animations_path) {
//auto surface = Resource::get()->getSurface(surface_path);
auto animations = Resource::get()->getAnimations(animations_path);
sprite_ = std::make_shared<SurfaceAnimatedSprite>(surface, animations);
sprite_ = std::make_shared<SurfaceAnimatedSprite>(/*surface, */animations);
sprite_->setWidth(WIDTH);
sprite_->setHeight(HEIGHT);
sprite_->setCurrentAnimation("walk");

View File

@@ -47,7 +47,7 @@ class Player {
struct Data {
SpawnData spawn_data{};
std::string texture_path{};
//std::string texture_path{};
std::string animations_path{};
std::shared_ptr<Room> room = nullptr;
@@ -57,7 +57,7 @@ class Player {
// Constructor con parámetros
Data(SpawnData spawn_data, std::string texture_path, std::string animations_path, std::shared_ptr<Room> room)
: spawn_data(std::move(spawn_data)),
texture_path(std::move(texture_path)),
//texture_path(std::move(texture_path)),
animations_path(std::move(animations_path)),
room(std::move(room)) {}
};
@@ -147,7 +147,7 @@ class Player {
void initSounds(); // Inicializa los sonidos de salto y caida
void placeSprite() { sprite_->setPos(x_, y_); } // Coloca el sprite en la posición del jugador
void applySpawnValues(const SpawnData& spawn); // Aplica los valores de spawn al jugador
void initSprite(const std::string& surface_path, const std::string& animations_path); // Inicializa el sprite del jugador
void initSprite(/*const std::string& surface_path, */const std::string& animations_path); // Inicializa el sprite del jugador
#ifdef _DEBUG
// --- Variables ---