canvi d'skin en la consola
This commit is contained in:
@@ -764,6 +764,14 @@ void Player::applySpawnValues(const SpawnData& spawn) {
|
||||
sprite_->setFlip(spawn.flip);
|
||||
}
|
||||
|
||||
// Cambia la skin del jugador en caliente preservando la orientación actual
|
||||
void Player::setSkin(int skin_num) {
|
||||
const auto FLIP = sprite_->getFlip();
|
||||
const std::string PATH = (skin_num == 2) ? "player2.yaml" : "player.yaml";
|
||||
initSprite(PATH);
|
||||
sprite_->setFlip(FLIP);
|
||||
}
|
||||
|
||||
// Inicializa el sprite del jugador
|
||||
void Player::initSprite(const std::string& animations_path) { // NOLINT(readability-convert-member-functions-to-static)
|
||||
const auto& animation_data = Resource::Cache::get()->getAnimationData(animations_path);
|
||||
|
||||
@@ -100,6 +100,7 @@ class Player {
|
||||
auto getCollider() -> SDL_FRect& { return collider_box_; } // Obtiene el rectangulo de colision del jugador
|
||||
auto getSpawnParams() -> SpawnData { return {.x = x_, .y = y_, .vx = vx_, .vy = vy_, .last_grounded_position = last_grounded_position_, .state = state_, .flip = sprite_->getFlip()}; } // Obtiene el estado de reaparición del jugador
|
||||
void setColor(Uint8 color = 0); // Establece el color del jugador (0 = automático según cheats)
|
||||
void setSkin(int skin_num); // Cambia la skin del jugador en caliente (1=normal, 2=alternativa)
|
||||
void setRoom(std::shared_ptr<Room> room) { room_ = std::move(room); } // Establece la habitación en la que se encuentra el jugador
|
||||
//[[nodiscard]] auto isAlive() const -> bool { return is_alive_ || (Options::cheats.invincible == Options::Cheat::State::ENABLED); } // Comprueba si el jugador esta vivo
|
||||
[[nodiscard]] auto isAlive() const -> bool { return is_alive_; } // Comprueba si el jugador esta vivo
|
||||
|
||||
Reference in New Issue
Block a user