fix: els globos tenien un parell de setters mal asignats per culpa de buscar y reemplazar
fix: els globos verds s'inicialitzaven amb vy = 0 per gastar abs en lloc de fabs fix: corregit un bug milenari que de sempre havia creat els balloons verds al popar al pare amb la meitat de velocitat en y. Lo que jo no se es com anava res. Supose que ara el joc serà un poc mes xungo. Quan rebotaven en el piso ja se'ls posava la velocitat bona (crec)
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "texture.h" // for Texture
|
||||
struct JA_Music_t; // lines 35-35
|
||||
struct JA_Sound_t; // lines 36-36
|
||||
#include "dbgtxt.h"
|
||||
|
||||
// Constructor
|
||||
Game::Game(int player_id, int current_stage, bool demo)
|
||||
@@ -438,7 +439,7 @@ void Game::deployBalloonFormation()
|
||||
else
|
||||
{
|
||||
// Decrementa el contador de despliegues enemigos de la PowerBall
|
||||
power_ball_counter_ > 0 ? power_ball_counter_-- : power_ball_counter_ = 0;
|
||||
power_ball_counter_ = (power_ball_counter_ > 0) ? (power_ball_counter_ - 1) : 0;
|
||||
|
||||
// Elige una formación enemiga la azar
|
||||
auto set = rand() % 10;
|
||||
@@ -646,9 +647,8 @@ void Game::renderBalloons()
|
||||
std::shared_ptr<Balloon> Game::createBalloon(float x, int y, int kind, float velx, float speed, int creation_timer)
|
||||
{
|
||||
const auto index = (kind - 1) % 4;
|
||||
auto b = std::make_shared<Balloon>(x, y, kind, velx, speed, creation_timer, balloon_textures_[index], balloon_animations_[index]);
|
||||
balloons_.push_back(b);
|
||||
return b;
|
||||
balloons_.emplace_back(std::make_shared<Balloon>(x, y, kind, velx, speed, creation_timer, balloon_textures_[index], balloon_animations_[index]));
|
||||
return balloons_.back();
|
||||
}
|
||||
|
||||
// Crea una PowerBall
|
||||
@@ -747,11 +747,11 @@ void Game::popBalloon(std::shared_ptr<Balloon> balloon)
|
||||
{ // En cualquier otro caso, crea dos globos de un tipo inferior
|
||||
auto balloon_left = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, balloon_speed_, 0);
|
||||
balloon_left->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
|
||||
balloon_left->setVelY(balloon_left->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE);
|
||||
balloon_left->setVelY(balloon_left->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE * 2.0f);
|
||||
|
||||
auto balloon_right = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, balloon_speed_, 0);
|
||||
balloon_right->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
|
||||
balloon_right->setVelY(balloon_right->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE);
|
||||
balloon_right->setVelY(balloon_right->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE * 2.0f);
|
||||
|
||||
// Elimina el globo
|
||||
explosions_->add(balloon->getPosX(), balloon->getPosY(), size);
|
||||
|
||||
Reference in New Issue
Block a user