Trabajando en hacer que puedas entrar a la jail
This commit is contained in:
@@ -13,7 +13,7 @@ ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset,
|
||||
this->options = options;
|
||||
|
||||
// Reserva memoria para los objetos
|
||||
//playerTexture = resource->getTexture("player.png");
|
||||
// playerTexture = resource->getTexture("player.png");
|
||||
itemTexture = resource->getTexture("items.png");
|
||||
sprite = new AnimatedSprite(renderer, resource->getAnimation("player.ani"));
|
||||
sprite->setCurrentAnimation("walk_menu");
|
||||
@@ -25,6 +25,7 @@ ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset,
|
||||
paused = false;
|
||||
timePaused = 0;
|
||||
totalTimePaused = 0;
|
||||
itemsColor = stringToColor(options->palette, "white");
|
||||
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<std::string> vColors = {"blue", "magenta", "green", "cyan", "yellow", "white", "bright_blue", "bright_magenta", "bright_green", "bright_cyan", "bright_yellow", "bright_white"};
|
||||
@@ -79,7 +80,7 @@ void ScoreBoard::render()
|
||||
const std::string timeTxt = std::to_string((clock.minutes % 60) / 10) + std::to_string(clock.minutes % 10) + clock.separator + std::to_string((clock.seconds % 60) / 10) + std::to_string(clock.seconds % 10);
|
||||
const std::string itemsTxt = std::to_string(board->items / 100) + std::to_string((board->items % 100) / 10) + std::to_string(board->items % 10);
|
||||
this->text->writeColored(BLOCK, line1, "Items collected ", board->color);
|
||||
this->text->writeColored(17 * BLOCK, line1, itemsTxt, stringToColor(options->palette, "white"));
|
||||
this->text->writeColored(17 * BLOCK, line1, itemsTxt, itemsColor);
|
||||
this->text->writeColored(20 * BLOCK, line1, " Time ", board->color);
|
||||
this->text->writeColored(26 * BLOCK, line1, timeTxt, stringToColor(options->palette, "white"));
|
||||
|
||||
@@ -94,6 +95,9 @@ void ScoreBoard::update()
|
||||
counter++;
|
||||
sprite->update();
|
||||
|
||||
// Actualiza el color de la cantidad de items recogidos
|
||||
updateItemsColor();
|
||||
|
||||
if (!paused)
|
||||
{ // Si está en pausa no se actualiza el reloj
|
||||
clock = getTime();
|
||||
@@ -118,7 +122,7 @@ ScoreBoard::clock_t ScoreBoard::getTime()
|
||||
void ScoreBoard::reLoadTexture()
|
||||
{
|
||||
sprite->getTexture()->reLoad();
|
||||
//playerTexture->reLoad();
|
||||
// playerTexture->reLoad();
|
||||
itemTexture->reLoad();
|
||||
text->reLoadTexture();
|
||||
}
|
||||
@@ -147,4 +151,22 @@ void ScoreBoard::resume()
|
||||
{
|
||||
paused = false;
|
||||
totalTimePaused += SDL_GetTicks() - timePaused;
|
||||
}
|
||||
|
||||
// Actualiza el color de la cantidad de items recogidos
|
||||
void ScoreBoard::updateItemsColor()
|
||||
{
|
||||
if (!board->jailEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (counter % 20 <10)
|
||||
{
|
||||
itemsColor = stringToColor(options->palette, "white");
|
||||
}
|
||||
else
|
||||
{
|
||||
itemsColor = stringToColor(options->palette, "magenta");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user