Ja no se que he tocat i qué no, cosetes del malo nou
This commit is contained in:
@@ -774,7 +774,7 @@ void Game::createItemText(int x, std::shared_ptr<Texture> texture)
|
||||
const auto h = texture->getHeight();
|
||||
|
||||
const int y0 = param.game.play_area.rect.h - h;
|
||||
const int y1 = 155;
|
||||
const int y1 = 160 - (h / 2);
|
||||
const int y2 = -h;
|
||||
|
||||
// Ajusta para que no se dibuje fuera de pantalla
|
||||
@@ -1262,10 +1262,10 @@ void Game::checkEvents()
|
||||
createItem(ItemType::CLOCK, players_.at(0)->getPosX(), players_.at(0)->getPosY() - 40);
|
||||
break;
|
||||
}
|
||||
case SDLK_5: // Crea un PathSprite
|
||||
case SDLK_5: // 5.000
|
||||
{
|
||||
const int x = players_.at(0)->getPosX() + (players_.at(0)->getWidth() - game_text_textures_[3]->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(3));
|
||||
createItemText(x, game_text_textures_.at(2));
|
||||
break;
|
||||
}
|
||||
case SDLK_6: // Crea un mensaje
|
||||
@@ -1273,10 +1273,13 @@ void Game::checkEvents()
|
||||
createMessage({paths_.at(0), paths_.at(1)}, Resource::get()->getTexture("game_text_get_ready"));
|
||||
break;
|
||||
}
|
||||
case SDLK_7: // Flash
|
||||
case SDLK_7: // 100.000
|
||||
{
|
||||
// screen_->flash(flash_color, 3);
|
||||
tabe_->setState(TabeState::HIT);
|
||||
// tabe_->setState(TabeState::HIT);
|
||||
const int x = players_.at(0)->getPosX() + (players_.at(0)->getWidth() - game_text_textures_[3]->getWidth()) / 2;
|
||||
createItemText(x, game_text_textures_.at(6));
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case SDLK_8:
|
||||
|
||||
@@ -102,6 +102,8 @@ void Tabe::enable()
|
||||
{
|
||||
enabled_ = true;
|
||||
has_bonus_ = true;
|
||||
hit_counter_ = 0;
|
||||
number_of_hits_ = 0;
|
||||
y_ = param.game.game_area.rect.y + 20.0f;
|
||||
|
||||
// Establece una dirección aleatoria
|
||||
@@ -164,7 +166,8 @@ void Tabe::setState(TabeState state)
|
||||
|
||||
case TabeState::HIT:
|
||||
sprite_->setCurrentAnimation("hit");
|
||||
hit_counter = 5;
|
||||
hit_counter_ = 5;
|
||||
++number_of_hits_;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -178,8 +181,8 @@ void Tabe::updateState()
|
||||
{
|
||||
if (state_ == TabeState::HIT)
|
||||
{
|
||||
--hit_counter;
|
||||
if (hit_counter == 0)
|
||||
--hit_counter_;
|
||||
if (hit_counter_ == 0)
|
||||
{
|
||||
setState(TabeState::FLY);
|
||||
}
|
||||
@@ -189,7 +192,7 @@ void Tabe::updateState()
|
||||
// Intenta obtener el bonus
|
||||
bool Tabe::tryToGetBonus()
|
||||
{
|
||||
if (has_bonus_ && rand() % 8 == 0)
|
||||
if (has_bonus_ && rand() % std::max(1, 10 - number_of_hits_) == 0)
|
||||
{
|
||||
has_bonus_ = false;
|
||||
return true;
|
||||
|
||||
@@ -37,7 +37,8 @@ private:
|
||||
TabeDirection direction_; // Dirección del objeto
|
||||
TabeDirection destiny_; // Destino del objeto
|
||||
TabeState state_ = TabeState::FLY; // Estado
|
||||
int hit_counter = 0; // Contador para el estado HIT
|
||||
int hit_counter_ = 0; // Contador para el estado HIT
|
||||
int number_of_hits_ = 0; // Cantidad de disparos que ha recibido
|
||||
bool has_bonus_ = true; // Indica si el Tabe aun tiene el bonus para soltar
|
||||
|
||||
// Mueve el objeto
|
||||
|
||||
Reference in New Issue
Block a user