canvi de pc

This commit is contained in:
2025-02-27 07:37:39 +01:00
parent e6fd4225a2
commit c6474cb2da
26 changed files with 903 additions and 991 deletions

View File

@@ -41,13 +41,13 @@ Game::Game()
current_room_ = "03.room";
const int x = 25;
const int y = 13;
spawn_point_ = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
spawn_point_ = PlayerSpawn(x * 8, y * 8, 0, 0, 0, PlayerState::STANDING, SDL_FLIP_HORIZONTAL);
debug_->setEnabled(false);
#else
current_room_ = "03.room";
const int x = 25;
const int y = 13;
spawn_point_ = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
spawn_point_ = PlayerSpawn(x * 8, y * 8, 0, 0, 0, PlayerState::STANDING, SDL_FLIP_HORIZONTAL);
#endif
// Crea los objetos
@@ -57,7 +57,7 @@ Game::Game()
room_ = std::make_shared<Room>(resource_->getRoom(current_room_), &board_.items, false);
const std::string playerPNG = options.cheats.alternate_skin == Cheat::CheatState::ENABLED ? "player2.png" : "player.png";
const std::string playerANI = options.cheats.alternate_skin == Cheat::CheatState::ENABLED ? "player2.ani" : "player.ani";
const player_t player = {spawn_point_, playerPNG, playerANI, room_};
const PlayerData player(spawn_point_, playerPNG, playerANI, room_);
player_ = std::make_shared<Player>(player);
text_ = resource_->getText("smb2");
music_ = resource_->getMusic("game.ogg");
@@ -85,7 +85,6 @@ Game::Game()
// Inicializa el resto de variables
ticks_ = 0;
ticks_speed_ = 15;
board_.lives = 9;
#ifdef DEBUG
board_.lives = 9;
@@ -217,7 +216,7 @@ void Game::run()
void Game::update()
{
// Comprueba que la diferencia de ticks sea mayor a la velocidad del juego
if (SDL_GetTicks() - ticks_ > ticks_speed_)
if (SDL_GetTicks() - ticks_ > GAME_SPEED)
{
// Actualiza el contador de ticks
ticks_ = SDL_GetTicks();
@@ -283,7 +282,7 @@ void Game::updateDebugInfo()
{
debug_->add("X = " + std::to_string(static_cast<int>(player_->x_)) + ", Y = " + std::to_string(static_cast<int>(player_->y_)));
debug_->add("VX = " + std::to_string(player_->vx_).substr(0, 4) + ", VY = " + std::to_string(player_->vy_).substr(0, 4));
debug_->add("STATE = " + std::to_string(player_->state_));
debug_->add("STATE = " + std::to_string(static_cast<int>(player_->state_)));
}
// Pone la información de debug en pantalla
@@ -443,7 +442,7 @@ void Game::killPlayer()
room_ = std::make_shared<Room>(resource_->getRoom(current_room_), &board_.items, board_.jail_is_open);
const std::string playerPNG = options.cheats.alternate_skin == Cheat::CheatState::ENABLED ? "player2.png" : "player.png";
const std::string playerANI = options.cheats.alternate_skin == Cheat::CheatState::ENABLED ? "player2.ani" : "player.ani";
const player_t player = {spawn_point_, playerPNG, playerANI, room_};
const PlayerData player(spawn_point_, playerPNG, playerANI, room_);
player_ = std::make_shared<Player>(player);
// Pone los objetos en pausa mientras esta la habitación en negro