[DOC:29/10/2025] w i h ja no fan falta, se pilla del .ANI
This commit is contained in:
@@ -23,8 +23,10 @@ Enemy::Enemy(const Data& enemy)
|
|||||||
sprite_->setPosY(enemy.y);
|
sprite_->setPosY(enemy.y);
|
||||||
sprite_->setVelX(enemy.vx);
|
sprite_->setVelX(enemy.vx);
|
||||||
sprite_->setVelY(enemy.vy);
|
sprite_->setVelY(enemy.vy);
|
||||||
|
/* [DOC:29/10/2025] w i h ja no fan falta, se pilla del .ANI
|
||||||
sprite_->setWidth(enemy.w);
|
sprite_->setWidth(enemy.w);
|
||||||
sprite_->setHeight(enemy.h);
|
sprite_->setHeight(enemy.h);
|
||||||
|
[/DOC] */
|
||||||
|
|
||||||
const int FLIP = (should_flip_ && enemy.vx < 0.0F) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
|
const int FLIP = (should_flip_ && enemy.vx < 0.0F) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
|
||||||
const int MIRROR = should_mirror_ ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE;
|
const int MIRROR = should_mirror_ ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE;
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ class Enemy {
|
|||||||
struct Data {
|
struct Data {
|
||||||
std::string surface_path{}; // Ruta al fichero con la textura
|
std::string surface_path{}; // Ruta al fichero con la textura
|
||||||
std::string animation_path{}; // Ruta al fichero con la animación
|
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
|
int w = 0; // Anchura del enemigo
|
||||||
int h = 0; // Altura del enemigo
|
int h = 0; // Altura del enemigo
|
||||||
|
[/DOC] */
|
||||||
float x = 0.0f; // Posición inicial en el eje X
|
float x = 0.0f; // Posición inicial en el eje X
|
||||||
float y = 0.0f; // Posición inicial en el eje Y
|
float y = 0.0f; // Posición inicial en el eje Y
|
||||||
float vx = 0.0f; // Velocidad en el eje X
|
float vx = 0.0f; // Velocidad en el eje X
|
||||||
|
|||||||
@@ -865,10 +865,12 @@ auto Room::setEnemy(Enemy::Data* enemy, const std::string& key, const std::strin
|
|||||||
enemy->surface_path = value;
|
enemy->surface_path = value;
|
||||||
} else if (key == "animation") {
|
} else if (key == "animation") {
|
||||||
enemy->animation_path = value;
|
enemy->animation_path = value;
|
||||||
|
/* [DOC:29/10/2025] w i h ja no fan falta, se pilla del .ANI
|
||||||
} else if (key == "width") {
|
} else if (key == "width") {
|
||||||
enemy->w = std::stoi(value);
|
enemy->w = std::stoi(value);
|
||||||
} else if (key == "height") {
|
} else if (key == "height") {
|
||||||
enemy->h = std::stoi(value);
|
enemy->h = std::stoi(value);
|
||||||
|
[/DOC] */
|
||||||
} else if (key == "x") {
|
} else if (key == "x") {
|
||||||
enemy->x = std::stof(value) * TILE_SIZE;
|
enemy->x = std::stof(value) * TILE_SIZE;
|
||||||
} else if (key == "y") {
|
} else if (key == "y") {
|
||||||
|
|||||||
Reference in New Issue
Block a user