animacions noves per al jugador2,

cada jugador te el seu fitxer d'animacions per separat
This commit is contained in:
2025-10-21 20:42:17 +02:00
parent bf12c1664a
commit 9b8fdf289f
8 changed files with 163 additions and 17 deletions

View File

@@ -354,7 +354,8 @@ void Credits::throwBalloons(float delta_time) {
// Inicializa los jugadores
void Credits::initPlayers() {
std::vector<std::vector<std::shared_ptr<Texture>>> player_textures; // Vector con todas las texturas de los jugadores;
std::vector<std::vector<std::string>> player_animations; // Vector con las animaciones del jugador
std::vector<std::vector<std::string>> player1_animations; // Vector con las animaciones del jugador 1
std::vector<std::vector<std::string>> player2_animations; // Vector con las animaciones del jugador 2
// Texturas - Player1
std::vector<std::shared_ptr<Texture>> player1_textures;
@@ -375,8 +376,10 @@ void Credits::initPlayers() {
player_textures.push_back(player2_textures);
// Animaciones -- Jugador
player_animations.emplace_back(Resource::get()->getAnimation("player.ani"));
player_animations.emplace_back(Resource::get()->getAnimation("player_power.ani"));
player1_animations.emplace_back(Resource::get()->getAnimation("player1.ani"));
player1_animations.emplace_back(Resource::get()->getAnimation("player_power.ani"));
player2_animations.emplace_back(Resource::get()->getAnimation("player2.ani"));
player2_animations.emplace_back(Resource::get()->getAnimation("player_power.ani"));
// Crea los dos jugadores
const int Y = play_area_.y + play_area_.h - Player::WIDTH;
@@ -390,7 +393,7 @@ void Credits::initPlayers() {
config_player1.demo = DEMO;
config_player1.play_area = &play_area_;
config_player1.texture = player_textures.at(0);
config_player1.animations = player_animations;
config_player1.animations = player1_animations;
config_player1.hi_score_table = &Options::settings.hi_score_table;
config_player1.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER1) - 1);
players_.emplace_back(std::make_unique<Player>(config_player1));
@@ -404,7 +407,7 @@ void Credits::initPlayers() {
config_player2.demo = DEMO;
config_player2.play_area = &play_area_;
config_player2.texture = player_textures.at(1);
config_player2.animations = player_animations;
config_player2.animations = player2_animations;
config_player2.hi_score_table = &Options::settings.hi_score_table;
config_player2.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER2) - 1);
players_.emplace_back(std::make_unique<Player>(config_player2));

View File

@@ -204,9 +204,12 @@ void Game::setResources() {
player_textures_.push_back(player2_textures);
// Animaciones -- Jugador
player_animations_.clear();
player_animations_.emplace_back(Resource::get()->getAnimation("player.ani"));
player_animations_.emplace_back(Resource::get()->getAnimation("player_power.ani"));
player1_animations_.clear();
player1_animations_.emplace_back(Resource::get()->getAnimation("player1.ani"));
player1_animations_.emplace_back(Resource::get()->getAnimation("player_power.ani"));
player2_animations_.clear();
player2_animations_.emplace_back(Resource::get()->getAnimation("player2.ani"));
player2_animations_.emplace_back(Resource::get()->getAnimation("player_power.ani"));
// Animaciones -- Items
item_animations_.clear();
@@ -1613,7 +1616,7 @@ void Game::initPlayers(Player::Id player_id) {
.demo = demo_.enabled,
.play_area = &param.game.play_area.rect,
.texture = player_textures_.at(0),
.animations = player_animations_,
.animations = player1_animations_,
.hi_score_table = &Options::settings.hi_score_table,
.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER1) - 1),
.stage_info = stage_manager_.get()};
@@ -1640,7 +1643,7 @@ void Game::initPlayers(Player::Id player_id) {
.demo = demo_.enabled,
.play_area = &param.game.play_area.rect,
.texture = player_textures_.at(1),
.animations = player_animations_,
.animations = player2_animations_,
.hi_score_table = &Options::settings.hi_score_table,
.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER2) - 1),
.stage_info = stage_manager_.get()};

View File

@@ -134,7 +134,8 @@ class Game {
std::vector<std::shared_ptr<Texture>> game_text_textures_; // Vector con las texturas para los sprites con textos
std::vector<std::vector<std::string>> item_animations_; // Vector con las animaciones de los items
std::vector<std::vector<std::string>> player_animations_; // Vector con las animaciones del jugador
std::vector<std::vector<std::string>> player1_animations_; // Vector con las animaciones del jugador 1
std::vector<std::vector<std::string>> player2_animations_; // Vector con las animaciones del jugador 2
std::unique_ptr<PauseManager> pause_manager_; // Objeto para gestionar la pausa
std::unique_ptr<StageManager> stage_manager_; // Objeto para gestionar las fases

View File

@@ -506,7 +506,8 @@ void Title::setState(State state) {
// Inicializa los jugadores
void Title::initPlayers() {
std::vector<std::vector<std::shared_ptr<Texture>>> player_textures; // Vector con todas las texturas de los jugadores;
std::vector<std::vector<std::string>> player_animations; // Vector con las animaciones del jugador
std::vector<std::vector<std::string>> player1_animations; // Vector con las animaciones del jugador 1
std::vector<std::vector<std::string>> player2_animations; // Vector con las animaciones del jugador 2
// Texturas - Player1
std::vector<std::shared_ptr<Texture>> player1_textures;
@@ -527,8 +528,10 @@ void Title::initPlayers() {
player_textures.push_back(player2_textures);
// Animaciones -- Jugador
player_animations.emplace_back(Resource::get()->getAnimation("player.ani"));
player_animations.emplace_back(Resource::get()->getAnimation("player_power.ani"));
player1_animations.emplace_back(Resource::get()->getAnimation("player1.ani"));
player1_animations.emplace_back(Resource::get()->getAnimation("player_power.ani"));
player2_animations.emplace_back(Resource::get()->getAnimation("player2.ani"));
player2_animations.emplace_back(Resource::get()->getAnimation("player_power.ani"));
// Crea los dos jugadores
const int Y = param.title.press_start_position - (Player::HEIGHT / 2);
@@ -541,7 +544,7 @@ void Title::initPlayers() {
config_player1.demo = DEMO;
config_player1.play_area = &param.game.play_area.rect;
config_player1.texture = player_textures.at(0);
config_player1.animations = player_animations;
config_player1.animations = player1_animations;
config_player1.hi_score_table = &Options::settings.hi_score_table;
config_player1.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER1) - 1);
players_.emplace_back(std::make_unique<Player>(config_player1));
@@ -554,7 +557,7 @@ void Title::initPlayers() {
config_player2.demo = DEMO;
config_player2.play_area = &param.game.play_area.rect;
config_player2.texture = player_textures.at(1);
config_player2.animations = player_animations;
config_player2.animations = player2_animations;
config_player2.hi_score_table = &Options::settings.hi_score_table;
config_player2.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER2) - 1);
players_.emplace_back(std::make_unique<Player>(config_player2));