Compare commits
3 Commits
55638e2997
...
2ca218c075
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ca218c075 | |||
| a4dc3d20e2 | |||
| 6609021488 |
@@ -1,9 +1,9 @@
|
||||
#GAME
|
||||
# GAME
|
||||
gameWidth 320
|
||||
gameHeight 240
|
||||
itemSize 20
|
||||
|
||||
#FADE
|
||||
# FADE
|
||||
numSquaresWidth 160
|
||||
numSquaresHeight 120
|
||||
fadeRandomSquaresDelay 1
|
||||
@@ -11,12 +11,18 @@ fadeRandomSquaresMult 500
|
||||
fadePostDuration 80
|
||||
venetianSize 16
|
||||
|
||||
#SCOREBOARD
|
||||
# SCOREBOARD
|
||||
scoreboard.x 0
|
||||
scoreboard.y 200
|
||||
scoreboard.w 320
|
||||
scoreboard.h 40
|
||||
|
||||
#TITLE
|
||||
# TITLE
|
||||
pressStart 160
|
||||
titleCounter 800
|
||||
titleCounter 800
|
||||
|
||||
# BACKGROUND
|
||||
backgroundAttenuateColor.r 255
|
||||
backgroundAttenuateColor.g 255
|
||||
backgroundAttenuateColor.b 255
|
||||
backgroundAttenuateColor.a 0
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 935 B |
@@ -19,6 +19,8 @@ Background::Background(SDL_Renderer *renderer, Screen *screen, Asset *asset, par
|
||||
srcRect = {playArea.x, rect.h - playArea.h, playArea.w, playArea.h};
|
||||
dstRect = {0, 0, playArea.w, playArea.h};
|
||||
base = rect.h;
|
||||
color = {param->backgroundAttenuateColor.r, param->backgroundAttenuateColor.g, param->backgroundAttenuateColor.b};
|
||||
alphaColorText = alphaColorTextTemp = param->backgroundAttenuateAlpha;
|
||||
|
||||
gradientRect[0] = {0, 0, rect.w, rect.h};
|
||||
gradientRect[1] = {rect.w, 0, rect.w, rect.h};
|
||||
@@ -40,7 +42,7 @@ Background::Background(SDL_Renderer *renderer, Screen *screen, Asset *asset, par
|
||||
|
||||
buildingsSprite = new Sprite(0, 0, rect.w, 135, buildingsTexture, renderer);
|
||||
gradientSprite = new Sprite(0, 0, rect.w, rect.h, gradientsTexture, renderer);
|
||||
grassSprite = new Sprite(0, 0, 256, 6, grassTexture, renderer);
|
||||
grassSprite = new Sprite(0, 0, 320, 10, grassTexture, renderer);
|
||||
|
||||
// Inicializa objetos
|
||||
clouds1A->setSpriteClip(0, 0, cloudsTexture->getWidth(), 52);
|
||||
@@ -53,6 +55,12 @@ Background::Background(SDL_Renderer *renderer, Screen *screen, Asset *asset, par
|
||||
// Crea la textura para componer el fondo
|
||||
canvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, rect.w, rect.h);
|
||||
SDL_SetTextureBlendMode(canvas, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Crea la textura para atenuar el fondo
|
||||
colorText = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, rect.w, rect.h);
|
||||
SDL_SetTextureBlendMode(colorText, SDL_BLENDMODE_BLEND);
|
||||
setColor(color);
|
||||
SDL_SetTextureAlphaMod(colorText, alphaColorText);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -78,52 +86,28 @@ Background::~Background()
|
||||
delete gradientSprite;
|
||||
delete grassSprite;
|
||||
SDL_DestroyTexture(canvas);
|
||||
SDL_DestroyTexture(colorText);
|
||||
}
|
||||
|
||||
// Actualiza la lógica del objeto
|
||||
void Background::update()
|
||||
{
|
||||
// Aplica la velocidad calculada a las nubes
|
||||
clouds1A->setVelX(cloudsSpeed);
|
||||
clouds1B->setVelX(cloudsSpeed);
|
||||
clouds2A->setVelX(cloudsSpeed / 2);
|
||||
clouds2B->setVelX(cloudsSpeed / 2);
|
||||
// Actualiza el valor de alpha
|
||||
updateAlphaColorText();
|
||||
|
||||
// Mueve las nubes
|
||||
clouds1A->move();
|
||||
clouds1B->move();
|
||||
clouds2A->move();
|
||||
clouds2B->move();
|
||||
|
||||
// Calcula el offset de las nubes
|
||||
if (clouds1A->getPosX() < -clouds1A->getWidth())
|
||||
{
|
||||
clouds1A->setPosX(clouds1A->getWidth());
|
||||
}
|
||||
|
||||
if (clouds1B->getPosX() < -clouds1B->getWidth())
|
||||
{
|
||||
clouds1B->setPosX(clouds1B->getWidth());
|
||||
}
|
||||
|
||||
if (clouds2A->getPosX() < -clouds2A->getWidth())
|
||||
{
|
||||
clouds2A->setPosX(clouds2A->getWidth());
|
||||
}
|
||||
|
||||
if (clouds2B->getPosX() < -clouds2B->getWidth())
|
||||
{
|
||||
clouds2B->setPosX(clouds2B->getWidth());
|
||||
}
|
||||
// Actualiza las nubes
|
||||
updateCLouds();
|
||||
|
||||
// Calcula el frame de la hierba
|
||||
grassSprite->setSpriteClip(0, (6 * (counter / 20 % 2)), 256, 6);
|
||||
grassSprite->setSpriteClip(0, (10 * (counter / 20 % 2)), 320, 10);
|
||||
|
||||
// Calcula el valor de alpha
|
||||
alpha = std::max((255 - (int)(255 * transition)), 0);
|
||||
|
||||
// Incrementa el contador
|
||||
counter++;
|
||||
|
||||
fillCanvas();
|
||||
}
|
||||
|
||||
// Compone todos los elementos del fondo en la textura
|
||||
@@ -153,7 +137,7 @@ void Background::fillCanvas()
|
||||
buildingsSprite->render();
|
||||
|
||||
// Dibuja la hierba
|
||||
//grassSprite->render();
|
||||
grassSprite->render();
|
||||
|
||||
// Deja el renderizador apuntando donde estaba
|
||||
SDL_SetRenderTarget(renderer, temp);
|
||||
@@ -162,8 +146,11 @@ void Background::fillCanvas()
|
||||
// Dibuja el objeto
|
||||
void Background::render()
|
||||
{
|
||||
fillCanvas();
|
||||
// Fondo
|
||||
SDL_RenderCopy(renderer, canvas, &srcRect, &dstRect);
|
||||
|
||||
// Atenuación
|
||||
SDL_RenderCopy(renderer, colorText, &srcRect, &dstRect);
|
||||
}
|
||||
|
||||
// Vuelve a cargar las texturas
|
||||
@@ -213,4 +200,80 @@ void Background::setSrcDest(SDL_Rect value)
|
||||
void Background::setDstDest(SDL_Rect value)
|
||||
{
|
||||
dstRect = value;
|
||||
}
|
||||
|
||||
// Establece el color de atenuación
|
||||
void Background::setColor(color_t color)
|
||||
{
|
||||
this->color = color;
|
||||
|
||||
// Colorea la textura
|
||||
SDL_Texture *temp = SDL_GetRenderTarget(renderer);
|
||||
SDL_SetRenderTarget(renderer, colorText);
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
SDL_SetRenderTarget(renderer, temp);
|
||||
}
|
||||
|
||||
// Establece la transparencia de la atenuación
|
||||
void Background::setAlpha(int alpha)
|
||||
{
|
||||
// Guarda el valor actual
|
||||
alphaColorTextTemp = alphaColorText;
|
||||
|
||||
// Establece el nuevo valor
|
||||
alphaColorText = alpha;
|
||||
}
|
||||
|
||||
// Actualiza el valor de alpha
|
||||
void Background::updateAlphaColorText()
|
||||
{
|
||||
if (alphaColorText == alphaColorTextTemp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
alphaColorText > alphaColorTextTemp ? alphaColorTextTemp++ : alphaColorTextTemp--;
|
||||
SDL_SetTextureAlphaMod(colorText, alphaColorTextTemp);
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza las nubes
|
||||
void Background::updateCLouds()
|
||||
{
|
||||
// Aplica la velocidad calculada a las nubes
|
||||
clouds1A->setVelX(cloudsSpeed);
|
||||
clouds1B->setVelX(cloudsSpeed);
|
||||
clouds2A->setVelX(cloudsSpeed / 2);
|
||||
clouds2B->setVelX(cloudsSpeed / 2);
|
||||
|
||||
// Mueve las nubes
|
||||
clouds1A->move();
|
||||
clouds1B->move();
|
||||
clouds2A->move();
|
||||
clouds2B->move();
|
||||
|
||||
// Calcula el offset de las nubes
|
||||
if (clouds1A->getPosX() < -clouds1A->getWidth())
|
||||
{
|
||||
clouds1A->setPosX(clouds1A->getWidth());
|
||||
}
|
||||
|
||||
if (clouds1B->getPosX() < -clouds1B->getWidth())
|
||||
{
|
||||
clouds1B->setPosX(clouds1B->getWidth());
|
||||
}
|
||||
|
||||
if (clouds2A->getPosX() < -clouds2A->getWidth())
|
||||
{
|
||||
clouds2A->setPosX(clouds2A->getWidth());
|
||||
}
|
||||
|
||||
if (clouds2B->getPosX() < -clouds2B->getWidth())
|
||||
{
|
||||
clouds2B->setPosX(clouds2B->getWidth());
|
||||
}
|
||||
}
|
||||
@@ -17,20 +17,6 @@ private:
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||
|
||||
// Variables
|
||||
SDL_Rect gradientRect[4]; // Vector con las coordenadas de los 4 degradados para el cielo
|
||||
int gradientNumber; // Indica el número de degradado de fondo que se va a dibujar
|
||||
int alpha; // Transparencia entre los dos degradados
|
||||
float cloudsSpeed; // Velocidad a la que se desplazan las nubes
|
||||
float transition; // Nivel de transición del fondo 0..1
|
||||
int counter; // Contador interno
|
||||
SDL_Rect rect; // Tamaño del objeto fondo
|
||||
SDL_Rect srcRect; // Parte del objeto fondo que se va a dibujará en pantalla
|
||||
SDL_Rect dstRect; // Posición donde dibujar la parte del objeto fondo que se dibujará en pantalla
|
||||
SDL_Texture *canvas; // Textura para componer el fondo
|
||||
int base; // Linea de fondo coincidente con el area inferior de la zona de juego
|
||||
param_t *param; // Puntero con todos los parametros del programa
|
||||
|
||||
Texture *buildingsTexture; // Textura con los edificios de fondo
|
||||
Texture *cloudsTexture; // Textura con las nubes de fondo
|
||||
Texture *grassTexture; // Textura con la hierba del suelo
|
||||
@@ -45,9 +31,35 @@ private:
|
||||
Sprite *gradientSprite; // Sprite con los graficos del degradado de color de fondo
|
||||
Sprite *grassSprite; // Sprite para la hierba
|
||||
|
||||
SDL_Texture *canvas; // Textura para componer el fondo
|
||||
SDL_Texture *colorText; // Textura para atenuar el fondo
|
||||
|
||||
param_t *param; // Puntero con todos los parametros del programa
|
||||
|
||||
// Variables
|
||||
SDL_Rect gradientRect[4]; // Vector con las coordenadas de los 4 degradados para el cielo
|
||||
int gradientNumber; // Indica el número de degradado de fondo que se va a dibujar
|
||||
int alpha; // Transparencia entre los dos degradados
|
||||
float cloudsSpeed; // Velocidad a la que se desplazan las nubes
|
||||
float transition; // Nivel de transición del fondo 0..1
|
||||
int counter; // Contador interno
|
||||
SDL_Rect rect; // Tamaño del objeto fondo
|
||||
SDL_Rect srcRect; // Parte del objeto fondo que se va a dibujará en pantalla
|
||||
SDL_Rect dstRect; // Posición donde dibujar la parte del objeto fondo que se dibujará en pantalla
|
||||
int base; // Linea de fondo coincidente con el area inferior de la zona de juego
|
||||
color_t color; // Color para atenuar el fondo
|
||||
int alphaColorText; // Alpha para atenuar el fondo
|
||||
int alphaColorTextTemp; // Valor temporal para hacer la transición de alpha
|
||||
|
||||
// Compone todos los elementos del fondo en la textura
|
||||
void fillCanvas();
|
||||
|
||||
// Actualiza el valor de alpha
|
||||
void updateAlphaColorText();
|
||||
|
||||
// Actualiza las nubes
|
||||
void updateCLouds();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Background(SDL_Renderer *renderer, Screen *screen, Asset *asset, param_t *param);
|
||||
@@ -81,6 +93,12 @@ public:
|
||||
|
||||
// Ajusta el valor de la variable
|
||||
void setDstDest(SDL_Rect value);
|
||||
|
||||
// Establece el color de atenuación
|
||||
void setColor(color_t color);
|
||||
|
||||
// Establece la transparencia de la atenuación
|
||||
void setAlpha(int alpha);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -169,12 +169,12 @@ struct options_t
|
||||
// Estructura para almacenar todos los parámetros del juego
|
||||
struct param_t
|
||||
{
|
||||
// GAME
|
||||
int gameWidth; // Ancho de la resolucion nativa del juego
|
||||
int gameHeight; // Alto de la resolucion nativa del juego
|
||||
int itemSize; // Tamañoi de los items del juego
|
||||
|
||||
SDL_Rect scoreboard; // Posición y tamaño del marcador
|
||||
int itemSize; // Tamañoi de los items del juego
|
||||
|
||||
// FADE
|
||||
int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el FADE_RANDOM_SQUARE
|
||||
int numSquaresHeight; // Cantidad total de cuadraditos en vertical para el FADE_RANDOM_SQUARE
|
||||
int fadeRandomSquaresDelay; // Duración entre cada pintado de cuadrados
|
||||
@@ -182,8 +182,16 @@ struct param_t
|
||||
int fadePostDuration; // Duración final del fade
|
||||
int venetianSize; // Altura de los rectangulos para FADE_VENETIAN
|
||||
|
||||
// SCOREBOARD
|
||||
SDL_Rect scoreboard; // Posición y tamaño del marcador
|
||||
|
||||
// TITLE
|
||||
int pressStart; // Posición del texto para empezar a jugar
|
||||
int titleCounter; // Tiempo de inactividad del titulo
|
||||
|
||||
// BACKGROUND
|
||||
color_t backgroundAttenuateColor;
|
||||
int backgroundAttenuateAlpha;
|
||||
};
|
||||
|
||||
// Estructura para almacenar ficheros de sonido y su nombre
|
||||
|
||||
@@ -318,15 +318,19 @@ void Game::init(int playerID)
|
||||
evaluateAndSetMenace();
|
||||
|
||||
// Inicializa el bitmap de 1000 puntos
|
||||
const int height = 15;
|
||||
const int sprite1Width = 35;
|
||||
const int sprite2Width = 38;
|
||||
const int sprite3Width = 39;
|
||||
n1000Sprite->setPosX(0);
|
||||
n1000Sprite->setPosY(0);
|
||||
n1000Sprite->setWidth(26);
|
||||
n1000Sprite->setHeight(9);
|
||||
n1000Sprite->setWidth(sprite1Width);
|
||||
n1000Sprite->setHeight(height);
|
||||
n1000Sprite->setVelX(0.0f);
|
||||
n1000Sprite->setVelY(-0.5f);
|
||||
n1000Sprite->setAccelX(0.0f);
|
||||
n1000Sprite->setAccelY(-0.1f);
|
||||
n1000Sprite->setSpriteClip(0, 0, 26, 9);
|
||||
n1000Sprite->setSpriteClip(0, 0, sprite1Width, height);
|
||||
n1000Sprite->setEnabled(false);
|
||||
n1000Sprite->setEnabledCounter(0);
|
||||
n1000Sprite->setDestX(0);
|
||||
@@ -335,13 +339,13 @@ void Game::init(int playerID)
|
||||
// Inicializa el bitmap de 2500 puntos
|
||||
n2500Sprite->setPosX(0);
|
||||
n2500Sprite->setPosY(0);
|
||||
n2500Sprite->setWidth(28);
|
||||
n2500Sprite->setHeight(9);
|
||||
n2500Sprite->setWidth(sprite2Width);
|
||||
n2500Sprite->setHeight(height);
|
||||
n2500Sprite->setVelX(0.0f);
|
||||
n2500Sprite->setVelY(-0.5f);
|
||||
n2500Sprite->setAccelX(0.0f);
|
||||
n2500Sprite->setAccelY(-0.1f);
|
||||
n2500Sprite->setSpriteClip(26, 0, 28, 9);
|
||||
n2500Sprite->setSpriteClip(sprite1Width, 0, sprite2Width, height);
|
||||
n2500Sprite->setEnabled(false);
|
||||
n2500Sprite->setEnabledCounter(0);
|
||||
n2500Sprite->setDestX(0);
|
||||
@@ -350,13 +354,13 @@ void Game::init(int playerID)
|
||||
// Inicializa el bitmap de 5000 puntos
|
||||
n5000Sprite->setPosX(0);
|
||||
n5000Sprite->setPosY(0);
|
||||
n5000Sprite->setWidth(28);
|
||||
n5000Sprite->setHeight(9);
|
||||
n5000Sprite->setWidth(sprite3Width);
|
||||
n5000Sprite->setHeight(height);
|
||||
n5000Sprite->setVelX(0.0f);
|
||||
n5000Sprite->setVelY(-0.5f);
|
||||
n5000Sprite->setAccelX(0.0f);
|
||||
n5000Sprite->setAccelY(-0.1f);
|
||||
n5000Sprite->setSpriteClip(54, 0, 28, 9);
|
||||
n5000Sprite->setSpriteClip(sprite1Width + sprite2Width, 0, sprite3Width, height);
|
||||
n5000Sprite->setEnabled(false);
|
||||
n5000Sprite->setEnabledCounter(0);
|
||||
n5000Sprite->setDestX(0);
|
||||
@@ -798,10 +802,10 @@ void Game::initEnemyFormations()
|
||||
}
|
||||
}
|
||||
|
||||
const Uint16 creationTime = 300;
|
||||
const int creationTime = 300;
|
||||
int incX = 0;
|
||||
Uint8 incTime = 0;
|
||||
Uint8 j = 0;
|
||||
int incTime = 0;
|
||||
int j = 0;
|
||||
|
||||
// #00 - Dos enemigos BALLOON4 uno a cada extremo
|
||||
j = 0;
|
||||
@@ -1090,7 +1094,7 @@ void Game::initEnemyFormations()
|
||||
incTime = 0;
|
||||
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
||||
{
|
||||
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
|
||||
const int half = enemyFormation[j].numberOfEnemies / 2;
|
||||
if (i < half)
|
||||
{
|
||||
enemyFormation[j].init[i].x = x4_0 + (i * incX);
|
||||
@@ -1113,7 +1117,7 @@ void Game::initEnemyFormations()
|
||||
incTime = 3;
|
||||
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
||||
{
|
||||
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
|
||||
const int half = enemyFormation[j].numberOfEnemies / 2;
|
||||
if (i < half)
|
||||
{
|
||||
enemyFormation[j].init[i].x = x2_0 + (i * incX);
|
||||
@@ -1137,7 +1141,7 @@ void Game::initEnemyFormations()
|
||||
incTime = 10;
|
||||
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
||||
{
|
||||
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
|
||||
const int half = enemyFormation[j].numberOfEnemies / 2;
|
||||
if (i < half)
|
||||
{
|
||||
enemyFormation[j].init[i].x = x3_0 + (i * incX);
|
||||
@@ -1161,7 +1165,7 @@ void Game::initEnemyFormations()
|
||||
incTime = 10;
|
||||
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
||||
{
|
||||
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
|
||||
const int half = enemyFormation[j].numberOfEnemies / 2;
|
||||
if (i < half)
|
||||
{
|
||||
enemyFormation[j].init[i].x = x3_0 + (i * incX);
|
||||
@@ -1185,7 +1189,7 @@ void Game::initEnemyFormations()
|
||||
incTime = 5;
|
||||
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
||||
{
|
||||
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
|
||||
const int half = enemyFormation[j].numberOfEnemies / 2;
|
||||
if (i < half)
|
||||
{
|
||||
enemyFormation[j].init[i].x = x1_50;
|
||||
@@ -1209,7 +1213,7 @@ void Game::initEnemyFormations()
|
||||
incTime = 5;
|
||||
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
||||
{
|
||||
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
|
||||
const int half = enemyFormation[j].numberOfEnemies / 2;
|
||||
if (i < half)
|
||||
{
|
||||
enemyFormation[j].init[i].x = x1_50 + 20;
|
||||
@@ -1498,7 +1502,7 @@ void Game::deployEnemyFormation()
|
||||
powerBallCounter > 0 ? powerBallCounter-- : powerBallCounter = 0;
|
||||
|
||||
// Elige una formación enemiga la azar
|
||||
Uint8 set = (rand() % 10);
|
||||
int set = rand() % 10;
|
||||
|
||||
// Evita repetir la ultima formación enemiga desplegada
|
||||
if (set == lastEnemyDeploy)
|
||||
@@ -1506,7 +1510,7 @@ void Game::deployEnemyFormation()
|
||||
|
||||
lastEnemyDeploy = set;
|
||||
|
||||
const Uint8 numEnemies = stage[currentStage].enemyPool->set[set]->numberOfEnemies;
|
||||
const int numEnemies = stage[currentStage].enemyPool->set[set]->numberOfEnemies;
|
||||
for (int i = 0; i < numEnemies; ++i)
|
||||
{
|
||||
createBalloon(stage[currentStage].enemyPool->set[set]->init[i].x,
|
||||
@@ -1523,7 +1527,7 @@ void Game::deployEnemyFormation()
|
||||
}
|
||||
|
||||
// Aumenta el poder de la fase
|
||||
void Game::increaseStageCurrentPower(Uint8 power)
|
||||
void Game::increaseStageCurrentPower(int power)
|
||||
{
|
||||
stage[currentStage].currentPower += power;
|
||||
}
|
||||
@@ -1662,7 +1666,7 @@ void Game::updateDeath()
|
||||
if ((deathCounter == 250) || (deathCounter == 200) || (deathCounter == 180) || (deathCounter == 120) || (deathCounter == 60))
|
||||
{
|
||||
// Hace sonar aleatoriamente uno de los 4 sonidos de burbujas
|
||||
const Uint8 index = rand() % 4;
|
||||
const int index = rand() % 4;
|
||||
JA_Sound_t *sound[4] = {bubble1Sound, bubble2Sound, bubble3Sound, bubble4Sound};
|
||||
JA_PlaySound(sound[index], 0);
|
||||
}
|
||||
@@ -1700,12 +1704,12 @@ void Game::renderBalloons()
|
||||
}
|
||||
|
||||
// Crea un globo nuevo en el vector de globos
|
||||
Uint8 Game::createBalloon(float x, int y, Uint8 kind, float velx, float speed, Uint16 creationtimer)
|
||||
int Game::createBalloon(float x, int y, int kind, float velx, float speed, int creationtimer)
|
||||
{
|
||||
const int index = (kind - 1) % 4;
|
||||
Balloon *b = new Balloon(x, y, kind, velx, speed, creationtimer, balloonTextures[index], balloonAnimations[index], renderer);
|
||||
balloons.push_back(b);
|
||||
return (Uint8)(balloons.size() - 1);
|
||||
return (int)(balloons.size() - 1);
|
||||
}
|
||||
|
||||
// Crea una PowerBall
|
||||
@@ -1844,7 +1848,7 @@ void Game::popBalloon(Balloon *balloon)
|
||||
increaseStageCurrentPower(1);
|
||||
balloonsPopped++;
|
||||
|
||||
const Uint8 kind = balloon->getKind();
|
||||
const int kind = balloon->getKind();
|
||||
switch (kind)
|
||||
{
|
||||
// Si es del tipo más pequeño, simplemente elimina el globo
|
||||
@@ -1900,7 +1904,7 @@ void Game::popBalloon(Balloon *balloon)
|
||||
void Game::destroyBalloon(Balloon *balloon)
|
||||
{
|
||||
int score = 0;
|
||||
Uint8 power = 0;
|
||||
int power = 0;
|
||||
|
||||
// Calcula la puntuación y el poder que generaria el globo en caso de romperlo a él y a sus hijos
|
||||
switch (balloon->getSize())
|
||||
@@ -1981,7 +1985,7 @@ void Game::destroyAllBalloons()
|
||||
}
|
||||
|
||||
// Detiene todos los globos
|
||||
void Game::stopAllBalloons(Uint16 time)
|
||||
void Game::stopAllBalloons(int time)
|
||||
{
|
||||
for (auto balloon : balloons)
|
||||
{
|
||||
@@ -2007,9 +2011,9 @@ void Game::startAllBalloons()
|
||||
}
|
||||
|
||||
// Obtiene el número de globos activos
|
||||
Uint8 Game::countBalloons()
|
||||
int Game::countBalloons()
|
||||
{
|
||||
Uint8 num = 0;
|
||||
int num = 0;
|
||||
|
||||
for (auto balloon : balloons)
|
||||
{
|
||||
@@ -2154,7 +2158,7 @@ void Game::checkBulletBalloonCollision()
|
||||
bullet->disable();
|
||||
|
||||
// Suelta el item en caso de que salga uno
|
||||
const Uint8 droppeditem = dropItem();
|
||||
const int droppeditem = dropItem();
|
||||
// if ((droppeditem != NO_KIND) && !(demo.enabled) && !(demo.recording))
|
||||
if ((droppeditem != NO_KIND) && !(demo.recording))
|
||||
{
|
||||
@@ -2205,7 +2209,7 @@ void Game::renderBullets()
|
||||
}
|
||||
|
||||
// Crea un objeto bala
|
||||
void Game::createBullet(int x, int y, Uint8 kind, bool poweredUp, int owner)
|
||||
void Game::createBullet(int x, int y, int kind, bool poweredUp, int owner)
|
||||
{
|
||||
Bullet *b = new Bullet(x, y, kind, poweredUp, owner, bulletTexture, renderer);
|
||||
bullets.push_back(b);
|
||||
@@ -2253,11 +2257,11 @@ void Game::renderItems()
|
||||
}
|
||||
}
|
||||
|
||||
// Devuelve un item en función del azar
|
||||
Uint8 Game::dropItem()
|
||||
// Devuelve un item al azar y luego segun sus probabilidades
|
||||
int Game::dropItem()
|
||||
{
|
||||
const Uint8 luckyNumber = rand() % 100;
|
||||
const Uint8 item = rand() % 6;
|
||||
const int luckyNumber = rand() % 100;
|
||||
const int item = rand() % 6;
|
||||
|
||||
switch (item)
|
||||
{
|
||||
@@ -2330,9 +2334,9 @@ Uint8 Game::dropItem()
|
||||
}
|
||||
|
||||
// Crea un objeto item
|
||||
void Game::createItem(Uint8 kind, float x, float y)
|
||||
void Game::createItem(int kind, float x, float y)
|
||||
{
|
||||
Item *item = new Item(kind, x, y, itemTextures[kind], itemAnimations[kind], renderer);
|
||||
Item *item = new Item(kind, x, y, itemTextures[kind - 1], itemAnimations[kind - 1], renderer);
|
||||
items.push_back(item);
|
||||
}
|
||||
|
||||
@@ -2363,7 +2367,7 @@ void Game::createItemScoreSprite(int x, int y, SmartSprite *sprite)
|
||||
ss->setPosX(x);
|
||||
ss->setPosY(y);
|
||||
ss->setDestX(x);
|
||||
ss->setDestY(y - 15);
|
||||
ss->setDestY(y - 25);
|
||||
ss->setEnabled(true);
|
||||
ss->setEnabledCounter(100);
|
||||
}
|
||||
@@ -2477,7 +2481,7 @@ void Game::evaluateAndSetMenace()
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 Game::getMenace()
|
||||
int Game::getMenace()
|
||||
{
|
||||
return menaceCurrent;
|
||||
}
|
||||
@@ -2495,13 +2499,13 @@ bool Game::isTimeStopped()
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Game::setTimeStoppedCounter(Uint16 value)
|
||||
void Game::setTimeStoppedCounter(int value)
|
||||
{
|
||||
timeStoppedCounter = value;
|
||||
}
|
||||
|
||||
// Incrementa el valor de la variable
|
||||
void Game::incTimeStoppedCounter(Uint16 value)
|
||||
void Game::incTimeStoppedCounter(int value)
|
||||
{
|
||||
timeStoppedCounter += value;
|
||||
}
|
||||
@@ -2745,7 +2749,7 @@ void Game::updateMenace()
|
||||
}
|
||||
|
||||
const float percent = stage[currentStage].currentPower / stage[currentStage].powerToComplete;
|
||||
const Uint8 difference = stage[currentStage].maxMenace - stage[currentStage].minMenace;
|
||||
const int difference = stage[currentStage].maxMenace - stage[currentStage].minMenace;
|
||||
|
||||
// Aumenta el nivel de amenaza en función de la puntuación
|
||||
menaceThreshold = stage[currentStage].minMenace + (difference * percent);
|
||||
@@ -3256,6 +3260,13 @@ bool Game::allPlayersAreDead()
|
||||
// Comprueba los eventos que hay en cola
|
||||
void Game::checkEvents()
|
||||
{
|
||||
const Uint8 *keyStates = SDL_GetKeyboardState(nullptr);
|
||||
|
||||
if (keyStates[SDL_SCANCODE_H] != 0)
|
||||
{
|
||||
createItemScoreSprite(param->gameWidth / 2, param->gameWidth / 2, n1000Sprite);
|
||||
}
|
||||
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
|
||||
@@ -56,16 +56,16 @@ class Game
|
||||
private:
|
||||
struct enemyInits_t
|
||||
{
|
||||
int x; // Posición en el eje X donde crear al enemigo
|
||||
int y; // Posición en el eje Y donde crear al enemigo
|
||||
float velX; // Velocidad inicial en el eje X
|
||||
Uint8 kind; // Tipo de enemigo
|
||||
Uint16 creationCounter; // Temporizador para la creación del enemigo
|
||||
int x; // Posición en el eje X donde crear al enemigo
|
||||
int y; // Posición en el eje Y donde crear al enemigo
|
||||
float velX; // Velocidad inicial en el eje X
|
||||
int kind; // Tipo de enemigo
|
||||
int creationCounter; // Temporizador para la creación del enemigo
|
||||
};
|
||||
|
||||
struct enemyFormation_t // Contiene la información de una formación enemiga
|
||||
{
|
||||
Uint8 numberOfEnemies; // Cantidad de enemigos que forman la formación
|
||||
int numberOfEnemies; // Cantidad de enemigos que forman la formación
|
||||
enemyInits_t init[MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION]; // Vector con todas las inicializaciones de los enemigos de la formación
|
||||
};
|
||||
|
||||
@@ -77,11 +77,11 @@ private:
|
||||
struct stage_t // Contiene todas las variables relacionadas con una fase
|
||||
{
|
||||
enemyPool_t *enemyPool; // El conjunto de formaciones enemigas de la fase
|
||||
Uint16 currentPower; // Cantidad actual de poder
|
||||
Uint16 powerToComplete; // Cantidad de poder que se necesita para completar la fase
|
||||
Uint8 maxMenace; // Umbral máximo de amenaza de la fase
|
||||
Uint8 minMenace; // Umbral mínimo de amenaza de la fase
|
||||
Uint8 number; // Número de fase
|
||||
int currentPower; // Cantidad actual de poder
|
||||
int powerToComplete; // Cantidad de poder que se necesita para completar la fase
|
||||
int maxMenace; // Umbral máximo de amenaza de la fase
|
||||
int minMenace; // Umbral mínimo de amenaza de la fase
|
||||
int number; // Número de fase
|
||||
};
|
||||
|
||||
struct helper_t
|
||||
@@ -174,41 +174,41 @@ private:
|
||||
|
||||
// Variables
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint8 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
Uint32 hiScore; // Puntuación máxima
|
||||
bool hiScoreAchieved; // Indica si se ha superado la puntuación máxima
|
||||
std::string hiScoreName; // Nombre del jugador que ostenta la máxima puntuación
|
||||
stage_t stage[10]; // Variable con los datos de cada pantalla
|
||||
Uint8 currentStage; // Indica la fase actual
|
||||
Uint8 stageBitmapCounter; // Contador para el tiempo visible del texto de Stage
|
||||
int currentStage; // Indica la fase actual
|
||||
int stageBitmapCounter; // Contador para el tiempo visible del texto de Stage
|
||||
float stageBitmapPath[STAGE_COUNTER]; // Vector con los puntos Y por donde se desplaza el texto
|
||||
float getReadyBitmapPath[STAGE_COUNTER]; // Vector con los puntos X por donde se desplaza el texto
|
||||
Uint16 deathCounter; // Contador para la animación de muerte del jugador
|
||||
Uint8 menaceCurrent; // Nivel de amenaza actual
|
||||
Uint8 menaceThreshold; // Umbral del nivel de amenaza. Si el nivel de amenaza cae por debajo del umbral, se generan más globos. Si el umbral aumenta, aumenta el número de globos
|
||||
int deathCounter; // Contador para la animación de muerte del jugador
|
||||
int menaceCurrent; // Nivel de amenaza actual
|
||||
int menaceThreshold; // Umbral del nivel de amenaza. Si el nivel de amenaza cae por debajo del umbral, se generan más globos. Si el umbral aumenta, aumenta el número de globos
|
||||
bool timeStopped; // Indica si el tiempo está detenido
|
||||
Uint16 timeStoppedCounter; // Temporizador para llevar la cuenta del tiempo detenido
|
||||
int timeStoppedCounter; // Temporizador para llevar la cuenta del tiempo detenido
|
||||
Uint32 counter; // Contador para el juego
|
||||
Uint32 scoreDataFile[TOTAL_SCORE_DATA]; // Datos del fichero de puntos
|
||||
Uint16 balloonsPopped; // Lleva la cuenta de los globos explotados
|
||||
Uint8 lastEnemyDeploy; // Guarda cual ha sido la última formación desplegada para no repetir;
|
||||
int balloonsPopped; // Lleva la cuenta de los globos explotados
|
||||
int lastEnemyDeploy; // Guarda cual ha sido la última formación desplegada para no repetir;
|
||||
int enemyDeployCounter; // Cuando se lanza una formación, se le da un valor y no sale otra hasta que llegue a cero
|
||||
float enemySpeed; // Velocidad a la que se mueven los enemigos
|
||||
float defaultEnemySpeed; // Velocidad base de los enemigos, sin incrementar
|
||||
helper_t helper; // Variable para gestionar las ayudas
|
||||
bool powerBallEnabled; // Indica si hay una powerball ya activa
|
||||
Uint8 powerBallCounter; // Contador de formaciones enemigas entre la aparicion de una PowerBall y otra
|
||||
int powerBallCounter; // Contador de formaciones enemigas entre la aparicion de una PowerBall y otra
|
||||
bool coffeeMachineEnabled; // Indica si hay una máquina de café en el terreno de juego
|
||||
bool gameCompleted; // Indica si se ha completado la partida, llegando al final de la ultima pantalla
|
||||
int gameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos
|
||||
Uint8 difficulty; // Dificultad del juego
|
||||
int difficulty; // Dificultad del juego
|
||||
float difficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad
|
||||
color_t difficultyColor; // Color asociado a la dificultad
|
||||
options_t *options; // Variable con todas las opciones del programa
|
||||
param_t *param; // Puntero con todos los parametros del programa
|
||||
enemyFormation_t enemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas
|
||||
enemyPool_t enemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas
|
||||
Uint8 lastStageReached; // Contiene el número de la última pantalla que se ha alcanzado
|
||||
int lastStageReached; // Contiene el número de la última pantalla que se ha alcanzado
|
||||
demo_t demo; // Variable con todas las variables relacionadas con el modo demo
|
||||
int totalPowerToCompleteGame; // La suma del poder necesario para completar todas las fases
|
||||
bool paused; // Indica si el juego está pausado (no se deberia de poder utilizar en el modo arcade)
|
||||
@@ -254,7 +254,7 @@ private:
|
||||
void deployEnemyFormation();
|
||||
|
||||
// Aumenta el poder de la fase
|
||||
void increaseStageCurrentPower(Uint8 power);
|
||||
void increaseStageCurrentPower(int power);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setHiScore(Uint32 score);
|
||||
@@ -281,7 +281,7 @@ private:
|
||||
void renderBalloons();
|
||||
|
||||
// Crea un globo nuevo en el vector de globos
|
||||
Uint8 createBalloon(float x, int y, Uint8 kind, float velx, float speed, Uint16 stoppedcounter);
|
||||
int createBalloon(float x, int y, int kind, float velx, float speed, int stoppedcounter);
|
||||
|
||||
// Crea una PowerBall
|
||||
void createPowerBall();
|
||||
@@ -311,13 +311,13 @@ private:
|
||||
void destroyAllBalloons();
|
||||
|
||||
// Detiene todos los globos
|
||||
void stopAllBalloons(Uint16 time);
|
||||
void stopAllBalloons(int time);
|
||||
|
||||
// Pone en marcha todos los globos
|
||||
void startAllBalloons();
|
||||
|
||||
// Obtiene el número de globos activos
|
||||
Uint8 countBalloons();
|
||||
int countBalloons();
|
||||
|
||||
// Vacia el vector de globos
|
||||
void freeBalloons();
|
||||
@@ -338,7 +338,7 @@ private:
|
||||
void renderBullets();
|
||||
|
||||
// Crea un objeto bala
|
||||
void createBullet(int x, int y, Uint8 kind, bool poweredUp, int owner);
|
||||
void createBullet(int x, int y, int kind, bool poweredUp, int owner);
|
||||
|
||||
// Vacia el vector de balas
|
||||
void freeBullets();
|
||||
@@ -350,10 +350,10 @@ private:
|
||||
void renderItems();
|
||||
|
||||
// Devuelve un item en función del azar
|
||||
Uint8 dropItem();
|
||||
int dropItem();
|
||||
|
||||
// Crea un objeto item
|
||||
void createItem(Uint8 kind, float x, float y);
|
||||
void createItem(int kind, float x, float y);
|
||||
|
||||
// Vacia el vector de items
|
||||
void freeItems();
|
||||
@@ -380,7 +380,7 @@ private:
|
||||
void evaluateAndSetMenace();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 getMenace();
|
||||
int getMenace();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setTimeStopped(bool value);
|
||||
@@ -389,10 +389,10 @@ private:
|
||||
bool isTimeStopped();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setTimeStoppedCounter(Uint16 value);
|
||||
void setTimeStoppedCounter(int value);
|
||||
|
||||
// Incrementa el valor de la variable
|
||||
void incTimeStoppedCounter(Uint16 value);
|
||||
void incTimeStoppedCounter(int value);
|
||||
|
||||
// Actualiza la variable EnemyDeployCounter
|
||||
void updateEnemyDeployCounter();
|
||||
|
||||
@@ -76,6 +76,12 @@ void HiScoreTable::update()
|
||||
|
||||
counter++;
|
||||
|
||||
if (counter == 150)
|
||||
{
|
||||
background->setColor({0, 0, 0});
|
||||
background->setAlpha(96);
|
||||
}
|
||||
|
||||
if (counter == counterEnd)
|
||||
{
|
||||
fade->activate();
|
||||
@@ -254,7 +260,7 @@ std::string HiScoreTable::scoreToString(Uint32 num)
|
||||
void HiScoreTable::updateFade()
|
||||
{
|
||||
fade->update();
|
||||
|
||||
|
||||
if (fade->hasEnded() && fadeMode == FADE_IN)
|
||||
{
|
||||
fade->reset();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "item.h"
|
||||
|
||||
// Constructor
|
||||
Item::Item(Uint8 kind, float x, float y, Texture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer)
|
||||
Item::Item(int kind, float x, float y, Texture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer)
|
||||
{
|
||||
sprite = new AnimatedSprite(texture, renderer, "", animation);
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#define ITEM_H
|
||||
|
||||
// Tipos de objetos
|
||||
#define ITEM_POINTS_1_DISK 0
|
||||
#define ITEM_POINTS_2_GAVINA 1
|
||||
#define ITEM_POINTS_3_PACMAR 2
|
||||
#define ITEM_CLOCK 3
|
||||
#define ITEM_COFFEE 4
|
||||
#define ITEM_COFFEE_MACHINE 5
|
||||
#define ITEM_POINTS_1_DISK 1
|
||||
#define ITEM_POINTS_2_GAVINA 2
|
||||
#define ITEM_POINTS_3_PACMAR 3
|
||||
#define ITEM_CLOCK 4
|
||||
#define ITEM_COFFEE 5
|
||||
#define ITEM_COFFEE_MACHINE 6
|
||||
|
||||
// Clase Item
|
||||
class Item
|
||||
@@ -25,14 +25,14 @@ private:
|
||||
// Variables
|
||||
float posX; // Posición X del objeto
|
||||
float posY; // Posición Y del objeto
|
||||
Uint8 width; // Ancho del objeto
|
||||
Uint8 height; // Alto del objeto
|
||||
int width; // Ancho del objeto
|
||||
int height; // Alto del objeto
|
||||
float velX; // Velocidad en el eje X
|
||||
float velY; // Velocidad en el eje Y
|
||||
float accelX; // Aceleración en el eje X
|
||||
float accelY; // Aceleración en el eje Y
|
||||
bool floorCollision; // Indica si el objeto colisiona con el suelo
|
||||
Uint8 kind; // Especifica el tipo de objeto que es
|
||||
int kind; // Especifica el tipo de objeto que es
|
||||
bool enabled; // Especifica si el objeto está habilitado
|
||||
circle_t collider; // Circulo de colisión del objeto
|
||||
|
||||
@@ -41,11 +41,12 @@ private:
|
||||
|
||||
// Actualiza la posición y estados del objeto
|
||||
void move();
|
||||
|
||||
public:
|
||||
Uint16 timeToLive; // Temporizador con el tiempo que el objeto está presente
|
||||
|
||||
// Constructor
|
||||
Item(Uint8 kind, float x, float y, Texture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer);
|
||||
Item(int kind, float x, float y, Texture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer);
|
||||
|
||||
// Destructor
|
||||
~Item();
|
||||
@@ -56,7 +57,6 @@ public:
|
||||
// Pinta el objeto en la pantalla
|
||||
void render();
|
||||
|
||||
|
||||
// Pone a cero todos los valores del objeto
|
||||
void disable();
|
||||
|
||||
|
||||
@@ -8,24 +8,29 @@ bool setOptions(param_t *param, std::string var, std::string value);
|
||||
// Establece valores por defecto a las variables
|
||||
void initParam(param_t *param)
|
||||
{
|
||||
// Tamaño original del juego
|
||||
// GAME
|
||||
param->gameWidth = 320;
|
||||
param->gameHeight = 240;
|
||||
param->itemSize = 20;
|
||||
|
||||
// Tamaño para el marcador
|
||||
param->scoreboard = {0, 208, 320, 32};
|
||||
// SCOREBOARD
|
||||
param->scoreboard = {0, 200, 320, 40};
|
||||
|
||||
// Valores para el FADE_RANDOM_SQUARE
|
||||
param->numSquaresWidth = 80;
|
||||
param->numSquaresHeight = 60;
|
||||
// FADE
|
||||
param->numSquaresWidth = 160;
|
||||
param->numSquaresHeight = 120;
|
||||
param->fadeRandomSquaresDelay = 1;
|
||||
param->fadeRandomSquaresMult = 8;
|
||||
param->fadePostDuration = 20;
|
||||
param->fadeRandomSquaresMult = 500;
|
||||
param->fadePostDuration = 80;
|
||||
param->venetianSize = 16;
|
||||
|
||||
// Posició del texto para empezar a jugar
|
||||
param->pressStart = 180;
|
||||
// TITLE
|
||||
param->pressStart = 160;
|
||||
param->titleCounter = 800;
|
||||
|
||||
// BACKGROUND
|
||||
param->backgroundAttenuateColor = {255, 255, 255};
|
||||
param->backgroundAttenuateAlpha = 32;
|
||||
}
|
||||
|
||||
// Establece valores para los parametros a partir de un fichero de texto
|
||||
@@ -121,7 +126,7 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
||||
// Indicador de éxito en la asignación
|
||||
bool success = true;
|
||||
|
||||
// Opciones de video
|
||||
// GAME
|
||||
if (var == "gameWidth")
|
||||
{
|
||||
param->gameWidth = std::stoi(value);
|
||||
@@ -137,6 +142,7 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
||||
param->itemSize = std::stoi(value);
|
||||
}
|
||||
|
||||
// FADE
|
||||
else if (var == "numSquaresWidth")
|
||||
{
|
||||
param->numSquaresWidth = std::stoi(value);
|
||||
@@ -167,6 +173,7 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
||||
param->venetianSize = std::stoi(value);
|
||||
}
|
||||
|
||||
// SCOREBOARD
|
||||
else if (var == "scoreboard.x")
|
||||
{
|
||||
param->scoreboard.x = std::stoi(value);
|
||||
@@ -187,6 +194,7 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
||||
param->scoreboard.h = std::stoi(value);
|
||||
}
|
||||
|
||||
// TITLE
|
||||
else if (var == "pressStart")
|
||||
{
|
||||
param->pressStart = std::stoi(value);
|
||||
@@ -197,6 +205,28 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
||||
param->titleCounter = std::stoi(value);
|
||||
}
|
||||
|
||||
// BACKGROUND
|
||||
else if (var == "backgroundAttenuateColor.r")
|
||||
{
|
||||
param->backgroundAttenuateColor.r = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "backgroundAttenuateColor.g")
|
||||
{
|
||||
param->backgroundAttenuateColor.g = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "backgroundAttenuateColor.b")
|
||||
{
|
||||
param->backgroundAttenuateColor.b = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "backgroundAttenuateColor.a")
|
||||
{
|
||||
param->backgroundAttenuateAlpha = std::stoi(value);
|
||||
}
|
||||
|
||||
// RESTO
|
||||
else
|
||||
{
|
||||
success = false;
|
||||
|
||||
@@ -94,7 +94,7 @@ void Player::init()
|
||||
}
|
||||
|
||||
// Actua en consecuencia de la entrada recibida
|
||||
void Player::setInput(Uint8 input)
|
||||
void Player::setInput(int input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
@@ -208,7 +208,7 @@ void Player::render()
|
||||
}
|
||||
|
||||
// Establece el estado del jugador cuando camina
|
||||
void Player::setWalkingStatus(Uint8 status)
|
||||
void Player::setWalkingStatus(int status)
|
||||
{
|
||||
// Si cambiamos de estado, reiniciamos la animación
|
||||
if (statusWalking != status)
|
||||
@@ -218,7 +218,7 @@ void Player::setWalkingStatus(Uint8 status)
|
||||
}
|
||||
|
||||
// Establece el estado del jugador cuando dispara
|
||||
void Player::setFiringStatus(Uint8 status)
|
||||
void Player::setFiringStatus(int status)
|
||||
{
|
||||
// Si cambiamos de estado, reiniciamos la animación
|
||||
if (statusFiring != status)
|
||||
@@ -498,7 +498,7 @@ void Player::updatePowerUpCounter()
|
||||
else
|
||||
{
|
||||
powerUp = false;
|
||||
powerUpCounter = PLAYER_POWERUP_COUNTER;
|
||||
//powerUpCounter = PLAYER_POWERUP_COUNTER;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ void Player::disableInput()
|
||||
}
|
||||
|
||||
// Devuelve el número de cafes actuales
|
||||
Uint8 Player::getCoffees()
|
||||
int Player::getCoffees()
|
||||
{
|
||||
return coffees;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ private:
|
||||
float defaultPosX; // Posición inicial para el jugador
|
||||
int defaultPosY; // Posición inicial para el jugador
|
||||
|
||||
Uint8 width; // Anchura
|
||||
Uint8 height; // Altura
|
||||
int width; // Anchura
|
||||
int height; // Altura
|
||||
|
||||
float velX; // Cantidad de pixeles a desplazarse en el eje X
|
||||
int velY; // Cantidad de pixeles a desplazarse en el eje Y
|
||||
@@ -55,13 +55,13 @@ private:
|
||||
Uint32 score; // Puntos del jugador
|
||||
float scoreMultiplier; // Multiplicador de puntos
|
||||
|
||||
Uint8 statusWalking; // Estado del jugador
|
||||
Uint8 statusFiring; // Estado del jugador
|
||||
int statusWalking; // Estado del jugador
|
||||
int statusFiring; // Estado del jugador
|
||||
|
||||
bool invulnerable; // Indica si el jugador es invulnerable
|
||||
Uint16 invulnerableCounter; // Contador para la invulnerabilidad
|
||||
bool extraHit; // Indica si el jugador tiene un toque extra
|
||||
Uint8 coffees; // Indica cuantos cafes lleva acumulados
|
||||
int coffees; // Indica cuantos cafes lleva acumulados
|
||||
bool powerUp; // Indica si el jugador tiene activo el modo PowerUp
|
||||
Uint16 powerUpCounter; // Temporizador para el modo PowerUp
|
||||
bool input; // Indica si puede recibir ordenes de entrada
|
||||
@@ -98,16 +98,16 @@ public:
|
||||
void setPlayerTextures(std::vector<Texture *> texture);
|
||||
|
||||
// Actua en consecuencia de la entrada recibida
|
||||
void setInput(Uint8 input);
|
||||
void setInput(int input);
|
||||
|
||||
// Mueve el jugador a la posición y animación que le corresponde
|
||||
void move();
|
||||
|
||||
// Establece el estado del jugador
|
||||
void setWalkingStatus(Uint8 status);
|
||||
void setWalkingStatus(int status);
|
||||
|
||||
// Establece el estado del jugador
|
||||
void setFiringStatus(Uint8 status);
|
||||
void setFiringStatus(int status);
|
||||
|
||||
// Establece la animación correspondiente al estado
|
||||
void setAnimation();
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
void disableInput();
|
||||
|
||||
// Devuelve el número de cafes actuales
|
||||
Uint8 getCoffees();
|
||||
int getCoffees();
|
||||
|
||||
// Obtiene el circulo de colisión
|
||||
circle_t &getCollider();
|
||||
|
||||
Reference in New Issue
Block a user