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

@@ -178,7 +178,8 @@ PALETTE|${PREFIX}/data/gfx/player/player2_invencible.pal
# Animaciones del jugador # Animaciones del jugador
ANIMATION|${PREFIX}/data/gfx/player/player_power.ani ANIMATION|${PREFIX}/data/gfx/player/player_power.ani
ANIMATION|${PREFIX}/data/gfx/player/player.ani ANIMATION|${PREFIX}/data/gfx/player/player1.ani
ANIMATION|${PREFIX}/data/gfx/player/player2.ani
# Fuentes de texto # Fuentes de texto
BITMAP|${PREFIX}/data/font/04b_25_2x.png BITMAP|${PREFIX}/data/font/04b_25_2x.png

135
data/gfx/player/player2.ani Normal file
View File

@@ -0,0 +1,135 @@
frame_width=32
frame_height=32
[animation]
name=walk
speed=0.0833
loop=0
frames=0,1,2,3
[/animation]
[animation]
name=stand
speed=0.167
loop=0
frames=4,5,6,7
[/animation]
[animation]
name=walk-fire-side
speed=0.0833
loop=0
frames=8,9,10,11
[/animation]
[animation]
name=walk-recoil-side
speed=0.0833
loop=0
frames=12,13,14,15
[/animation]
[animation]
name=walk-cool-side
speed=0.0833
loop=0
frames=16,17,18,19
[/animation]
[animation]
name=stand-fire-side
speed=0.0833
loop=0
frames=20
[/animation]
[animation]
name=stand-recoil-side
speed=0.0833
loop=0
frames=21
[/animation]
[animation]
name=stand-cool-side
speed=0.0833
loop=0
frames=22
[/animation]
[animation]
name=walk-fire-center
speed=0.0833
loop=0
frames=23,24,25,26
[/animation]
[animation]
name=walk-recoil-center
speed=0.0833
loop=0
frames=27,28,29,30
[/animation]
[animation]
name=walk-cool-center
speed=0.0833
loop=0
frames=31,32,33,34
[/animation]
[animation]
name=stand-fire-center
speed=0.0833
loop=0
frames=35
[/animation]
[animation]
name=stand-recoil-center
speed=0.0833
loop=0
frames=36
[/animation]
[animation]
name=stand-cool-center
speed=0.0833
loop=0
frames=37
[/animation]
[animation]
name=rolling
speed=0.167
loop=0
frames=38,39,40,41
[/animation]
[animation]
name=celebration
speed=0.167
loop=0
frames=47,47,47,47,47,47,48,49,50,51,51,51,51,51,51,50,50,50,51,51,51,50,50,50,49,48,47,47,47,42,42,42,43,44,45,46,45,46,45,46,45,46,45,46,45,46,45,44,43,42
[/animation]
[animation]
name=dizzy
speed=0.0833
loop=0
frames=52,53,54,55,56,57,58
[/animation]
[animation]
name=recover
speed=0.05
loop=-1
frames=59,59,59,59,60,61,62,63,63,63,64,65,66,63,64,65,66,63,64,65,66,67,67,67,67
[/animation]
[animation]
name=hello
speed=0.05
loop=-1
frames=68,69,70,71,72,73,74,75,76,77,78,78,78,78,78,78,78,78,78,78,78,78,78,79,80,81,82,83,84,85,86,87,87,86,85,84,84,85,86,87,87,86,85,84,84,85,86,87,87,86,85,84,84,85,86,87,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68
[/animation]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

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

View File

@@ -204,9 +204,12 @@ void Game::setResources() {
player_textures_.push_back(player2_textures); player_textures_.push_back(player2_textures);
// Animaciones -- Jugador // Animaciones -- Jugador
player_animations_.clear(); player1_animations_.clear();
player_animations_.emplace_back(Resource::get()->getAnimation("player.ani")); player1_animations_.emplace_back(Resource::get()->getAnimation("player1.ani"));
player_animations_.emplace_back(Resource::get()->getAnimation("player_power.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 // Animaciones -- Items
item_animations_.clear(); item_animations_.clear();
@@ -1613,7 +1616,7 @@ void Game::initPlayers(Player::Id player_id) {
.demo = demo_.enabled, .demo = demo_.enabled,
.play_area = &param.game.play_area.rect, .play_area = &param.game.play_area.rect,
.texture = player_textures_.at(0), .texture = player_textures_.at(0),
.animations = player_animations_, .animations = player1_animations_,
.hi_score_table = &Options::settings.hi_score_table, .hi_score_table = &Options::settings.hi_score_table,
.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER1) - 1), .glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER1) - 1),
.stage_info = stage_manager_.get()}; .stage_info = stage_manager_.get()};
@@ -1640,7 +1643,7 @@ void Game::initPlayers(Player::Id player_id) {
.demo = demo_.enabled, .demo = demo_.enabled,
.play_area = &param.game.play_area.rect, .play_area = &param.game.play_area.rect,
.texture = player_textures_.at(1), .texture = player_textures_.at(1),
.animations = player_animations_, .animations = player2_animations_,
.hi_score_table = &Options::settings.hi_score_table, .hi_score_table = &Options::settings.hi_score_table,
.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER2) - 1), .glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER2) - 1),
.stage_info = stage_manager_.get()}; .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::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>> 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<PauseManager> pause_manager_; // Objeto para gestionar la pausa
std::unique_ptr<StageManager> stage_manager_; // Objeto para gestionar las fases 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 // Inicializa los jugadores
void Title::initPlayers() { 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::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 // Texturas - Player1
std::vector<std::shared_ptr<Texture>> player1_textures; std::vector<std::shared_ptr<Texture>> player1_textures;
@@ -527,8 +528,10 @@ void Title::initPlayers() {
player_textures.push_back(player2_textures); player_textures.push_back(player2_textures);
// Animaciones -- Jugador // Animaciones -- Jugador
player_animations.emplace_back(Resource::get()->getAnimation("player.ani")); player1_animations.emplace_back(Resource::get()->getAnimation("player1.ani"));
player_animations.emplace_back(Resource::get()->getAnimation("player_power.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 // Crea los dos jugadores
const int Y = param.title.press_start_position - (Player::HEIGHT / 2); const int Y = param.title.press_start_position - (Player::HEIGHT / 2);
@@ -541,7 +544,7 @@ void Title::initPlayers() {
config_player1.demo = DEMO; config_player1.demo = DEMO;
config_player1.play_area = &param.game.play_area.rect; config_player1.play_area = &param.game.play_area.rect;
config_player1.texture = player_textures.at(0); 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.hi_score_table = &Options::settings.hi_score_table;
config_player1.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER1) - 1); 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)); players_.emplace_back(std::make_unique<Player>(config_player1));
@@ -554,7 +557,7 @@ void Title::initPlayers() {
config_player2.demo = DEMO; config_player2.demo = DEMO;
config_player2.play_area = &param.game.play_area.rect; config_player2.play_area = &param.game.play_area.rect;
config_player2.texture = player_textures.at(1); 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.hi_score_table = &Options::settings.hi_score_table;
config_player2.glowing_entry = &Options::settings.glowing_entries.at(static_cast<int>(Player::Id::PLAYER2) - 1); 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)); players_.emplace_back(std::make_unique<Player>(config_player2));