.
This commit is contained in:
@@ -87,15 +87,18 @@ Game::Game(int player_id, int current_stage, bool demo)
|
||||
SDL_SetTextureBlendMode(canvas_, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Crea los dos jugadores
|
||||
players_.emplace_back(std::make_unique<Player>(1, (param.game.play_area.first_quarter_x * ((0 * 2) + 1)) - 11, param.game.play_area.rect.h - 30, demo_.enabled, ¶m.game.play_area.rect, player_textures_[0], player_animations_));
|
||||
players_.back()->setScoreBoardPanel(SCOREBOARD_LEFT_PANEL);
|
||||
players_.back()->setName(lang::getText(53));
|
||||
players_.back()->setController(getController(players_.back()->getId()));
|
||||
{
|
||||
const int y = param.game.play_area.rect.h - 30;
|
||||
players_.emplace_back(std::make_unique<Player>(1, param.game.play_area.first_quarter_x - 15, y, demo_.enabled, param.game.play_area.rect, player_textures_[0], player_animations_));
|
||||
players_.back()->setScoreBoardPanel(SCOREBOARD_LEFT_PANEL);
|
||||
players_.back()->setName(lang::getText(53));
|
||||
players_.back()->setController(getController(players_.back()->getId()));
|
||||
|
||||
players_.emplace_back(std::make_unique<Player>(2, (param.game.play_area.first_quarter_x * ((1 * 2) + 1)) - 11, param.game.play_area.rect.h - 30, demo_.enabled, ¶m.game.play_area.rect, player_textures_[1], player_animations_));
|
||||
players_.back()->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL);
|
||||
players_.back()->setName(lang::getText(54));
|
||||
players_.back()->setController(getController(players_.back()->getId()));
|
||||
players_.emplace_back(std::make_unique<Player>(2, param.game.play_area.third_quarter_x - 15, y, demo_.enabled, param.game.play_area.rect, player_textures_[1], player_animations_));
|
||||
players_.back()->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL);
|
||||
players_.back()->setName(lang::getText(54));
|
||||
players_.back()->setController(getController(players_.back()->getId()));
|
||||
}
|
||||
|
||||
// Activa el jugador que coincide con el "player_id"
|
||||
{
|
||||
@@ -1132,7 +1135,7 @@ ItemType Game::dropItem()
|
||||
// Crea un objeto item
|
||||
void Game::createItem(ItemType type, float x, float y)
|
||||
{
|
||||
items_.emplace_back(std::make_unique<Item>(type, x, y, &(param.game.play_area.rect), item_textures_[static_cast<int>(type) - 1], item_animations_[static_cast<int>(type) - 1]));
|
||||
items_.emplace_back(std::make_unique<Item>(type, x, y, param.game.play_area.rect, item_textures_[static_cast<int>(type) - 1], item_animations_[static_cast<int>(type) - 1]));
|
||||
}
|
||||
|
||||
// Vacia el vector de items
|
||||
@@ -1327,8 +1330,9 @@ void Game::updateBalloonDeployCounter()
|
||||
// Actualiza el juego
|
||||
void Game::update()
|
||||
{
|
||||
// Comprueba que la diferencia de ticks sea mayor a la velocidad del juego
|
||||
if (SDL_GetTicks() - ticks_ > TICKS_SPEED_)
|
||||
constexpr int TICKS_SPEED = 15;
|
||||
|
||||
if (SDL_GetTicks() - ticks_ > TICKS_SPEED)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks_ = SDL_GetTicks();
|
||||
|
||||
Reference in New Issue
Block a user