fixing some bugs

This commit is contained in:
2021-08-26 20:49:49 +02:00
parent 3cb822ee6c
commit d240f8123c
13 changed files with 265 additions and 255 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -37,7 +37,7 @@
# 48 0
6
# 49 1
3
6
# 50 2
6
# 51 3

View File

@@ -3,192 +3,192 @@
# box height
8
# 32 espacio ( )
2
7
# 33 !
2
7
# 34 "
5
7
# 35 #
6
7
# 36 $
6
7
# 37 %
6
7
# 38 &
6
7
# 39 '
2
7
# 40 (
3
7
# 41 )
3
7
# 42 *
4
7
# 43 +
3
7
# 44 ,
2
7
# 45 -
3
7
# 46 .
2
7
# 47 /
4
7
# 48 0
6
7
# 49 1
3
7
# 50 2
6
7
# 51 3
6
7
# 52 4
6
7
# 53 5
6
7
# 54 6
6
7
# 55 7
6
7
# 56 8
6
7
# 57 9
6
7
# 58 :
2
7
# 59 ;
2
7
# 60 <
4
7
# 61 =
3
7
# 62 >
4
7
# 63 ?
6
7
# 64 @
8
7
# 65 A
6
7
# 66 B
6
7
# 67 C
6
7
# 68 D
6
7
# 69 E
6
7
# 70 F
6
7
# 71 G
6
7
# 72 H
6
7
# 73 I
6
7
# 74 J
6
7
# 75 K
6
7
# 76 L
6
7
# 77 M
6
7
# 78 N
6
7
# 79 O
6
7
# 80 P
6
7
# 81 Q
6
7
# 82 R
6
7
# 83 S
6
7
# 84 T
6
7
# 85 U
6
7
# 86 V
5
7
# 87 W
6
7
# 88 X
6
7
# 89 Y
6
7
# 90 Z
6
7
# 91 [
3
7
# 92 \
5
7
# 93 ]
3
7
# 94 ^
4
7
# 95 _
6
7
# 96 `
2
7
# 97 a
5
7
# 98 b
5
7
# 99 c
5
7
# 100 d
5
7
# 101 e
5
7
# 102 f
5
7
# 103 g
5
7
# 104 h
5
7
# 105 i
4
7
# 106 j
5
7
# 107 k
5
7
# 108 l
5
7
# 109 m
6
7
# 110 n
5
7
# 111 o
5
7
# 112 p
5
7
# 113 q
5
7
# 114 r
5
7
# 115 s
5
7
# 116 t
4
7
# 117 u
5
7
# 118 v
5
7
# 119 w
6
7
# 120 x
4
7
# 121 y
4
7
# 122 z
5
7
# 123 {
3
7
# 124 |
2
7
# 125 }
3
7
# 126 ~
3
7

View File

@@ -1,194 +1,194 @@
# box width
8
16
# box height
8
16
# 32 espacio ( )
2
16
# 33 !
2
16
# 34 "
5
16
# 35 #
6
16
# 36 $
6
16
# 37 %
6
16
# 38 &
6
16
# 39 '
2
16
# 40 (
3
16
# 41 )
3
16
# 42 *
4
16
# 43 +
3
16
# 44 ,
2
16
# 45 -
3
16
# 46 .
2
16
# 47 /
4
16
# 48 0
6
16
# 49 1
3
16
# 50 2
6
16
# 51 3
6
16
# 52 4
6
16
# 53 5
6
16
# 54 6
6
16
# 55 7
6
16
# 56 8
6
16
# 57 9
6
16
# 58 :
2
16
# 59 ;
2
16
# 60 <
4
16
# 61 =
3
16
# 62 >
4
16
# 63 ?
6
16
# 64 @
8
16
# 65 A
6
16
# 66 B
6
16
# 67 C
6
16
# 68 D
6
16
# 69 E
6
16
# 70 F
6
16
# 71 G
6
16
# 72 H
6
16
# 73 I
6
16
# 74 J
6
16
# 75 K
6
16
# 76 L
6
16
# 77 M
6
16
# 78 N
6
16
# 79 O
6
16
# 80 P
6
16
# 81 Q
6
16
# 82 R
6
16
# 83 S
6
16
# 84 T
6
16
# 85 U
6
16
# 86 V
5
16
# 87 W
6
16
# 88 X
6
16
# 89 Y
6
16
# 90 Z
6
16
# 91 [
3
16
# 92 \
5
16
# 93 ]
3
16
# 94 ^
4
16
# 95 _
6
16
# 96 `
2
16
# 97 a
5
16
# 98 b
5
16
# 99 c
5
16
# 100 d
5
16
# 101 e
5
16
# 102 f
5
16
# 103 g
5
16
# 104 h
5
16
# 105 i
4
16
# 106 j
5
16
# 107 k
5
16
# 108 l
5
16
# 109 m
6
16
# 110 n
5
16
# 111 o
5
16
# 112 p
5
16
# 113 q
5
16
# 114 r
5
16
# 115 s
5
16
# 116 t
4
16
# 117 u
5
16
# 118 v
5
16
# 119 w
6
16
# 120 x
4
16
# 121 y
4
16
# 122 z
5
16
# 123 {
3
16
# 124 |
2
16
# 125 }
3
16
# 126 ~
3
16

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -603,7 +603,8 @@ void Balloon::disable()
void Balloon::pop()
{
setPopping(true);
mSprite->setAnimationCounter(0);
mSprite->setAnimationCounter(0);
mSprite->disableRotate();
setTimeToLive(120);
setStop(true);
setStoppedTimer(2000);

View File

@@ -50,7 +50,7 @@ private:
float zoomW; // Zoom aplicado a la anchura
float zoomH; // Zoom aplicado a la altura
float despX; // Desplazamiento de pixeles en el eje X antes de pintar el objeto con zoom
float despY; // idem
float despY; // Desplazamiento de pixeles en el eje Y antes de pintar el objeto con zoom
// Vector con los valores de zoom para el ancho y alto del globo
float w[MAX_BOUNCE] = {1.10f, 1.05f, 1.00f, 0.95f, 0.90f, 0.95f, 1.00f, 1.02f, 1.05f, 1.02f};

View File

@@ -171,7 +171,7 @@ Game::~Game()
delete mTextureText;
mTextureText = nullptr;
mTextureTextScoreBoard->unload();
mTextureTextScoreBoard->unload();
delete mTextureTextScoreBoard;
mTextureTextScoreBoard = nullptr;
@@ -182,7 +182,7 @@ Game::~Game()
delete mText;
mText = nullptr;
delete mTextScoreBoard;
delete mTextScoreBoard;
mTextScoreBoard = nullptr;
delete mTextureTextBig;
@@ -401,7 +401,7 @@ void Game::init()
mSpriteScoreBoard->init(0, 160, SCREEN_WIDTH, 32, mTextureGameBG, mRenderer);
mSpriteScoreBoard->setSpriteClip(0, 160, 256, 32);
mSpritePowerMeter->init(PLAY_AREA_CENTER_THIRD_QUARTER_X - 20, HISCORE_NUMBER_Y + 4, 40, 8, mTextureGameBG, mRenderer);
mSpritePowerMeter->init(PLAY_AREA_CENTER_X - 20, 170, 40, 8, mTextureGameBG, mRenderer);
mSpritePowerMeter->setSpriteClip(256, 192 - 8, 40, 8);
// Vector de jugadores
@@ -1592,48 +1592,48 @@ void Game::renderScoreBoard()
mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
mSpritePowerMeter->render();
*/
const int offset1 = 162;
const int offset2 = offset1 + 7;
const int offset3 = offset2 + 7;
const int offset4 = offset3 + 7;
const int offset1 = 163;
const int offset2 = offset1 + 8;
const int offset3 = offset2 + 8;
const int offset4 = offset3 + 8;
// PLAYER1 - SCORE
mTextScoreBoard->writeCentered(49/2, offset1, mTextStrings[53]);
mTextScoreBoard->write(PLAY_AREA_LEFT+1, offset2, updateScoreText(mPlayer[0]->getScore()));
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset1, mTextStrings[53]);
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset2, updateScoreText(mPlayer[0]->getScore()));
// PLAYER1 - MULT
mTextScoreBoard->write(PLAY_AREA_LEFT+1, offset3, mTextStrings[55] + std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset3, mTextStrings[55] + std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
if (mNumPlayers == 2)
{
// PLAYER2 - SCORE
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - (49/2), offset1, mTextStrings[54]);
mTextScoreBoard->write(PLAY_AREA_RIGHT - 49, offset2, updateScoreText(mPlayer[1]->getScore()));
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mTextStrings[54]);
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, updateScoreText(mPlayer[1]->getScore()));
// PLAYER2 - MULT
mTextScoreBoard->write(PLAY_AREA_RIGHT - (8 * 10), offset3, mTextStrings[55]+std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mTextStrings[55] + std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
}
else
{
// PLAYER2 - SCORE
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - (49/2), offset1, mTextStrings[54]);
mTextScoreBoard->write(PLAY_AREA_RIGHT - 49, offset2, "0000000");
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mTextStrings[54]);
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, "0000000");
// PLAYER2 - MULT
mTextScoreBoard->write(PLAY_AREA_RIGHT - (8 * 10), offset3, mTextStrings[55] + "1.0");
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mTextStrings[55] + "1.0");
}
// STAGE
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, mTextStrings[57] + std::to_string(mStage[mCurrentStage].number));
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1-1, mTextStrings[57] + std::to_string(mStage[mCurrentStage].number));
// POWER
//mSpritePowerMeter->setSpriteClip(256, 184, 40, 8);
//mSpritePowerMeter->render();
//const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
//mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
//mSpritePowerMeter->render();
mSpritePowerMeter->setSpriteClip(256, 184, 40, 8);
mSpritePowerMeter->render();
const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
mSpritePowerMeter->render();
// HI-SCORE
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, mTextStrings[56] + "0000000");
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3+1, mTextStrings[56] + updateScoreText(mHiScore));
}
// Actualiza las variables del jugador
@@ -2269,10 +2269,10 @@ void Game::resetItems()
// Devuelve un item en función del azar
Uint8 Game::dropItem()
{
/*if (mPlayer->isPowerUp() || (mCoffeeMachineEnabled))
if (mPlayer[0]->isPowerUp() || (mCoffeeMachineEnabled))
return NO_KIND;
else
return ITEM_COFFEE_MACHINE;*/
return ITEM_COFFEE_MACHINE;
const Uint8 luckyNumber = rand() % 100;
const Uint8 item = rand() % 6;

View File

@@ -19,7 +19,7 @@ Instructions::Instructions(SDL_Renderer *renderer, std::string *fileList, std::s
mItemTexture = new LTexture();
mTextTexture = new LTexture();
mSprite = new Sprite();
mText = new Text(mFileList[46], mTextTexture, mRenderer);
mText = new Text(mFileList[48], mTextTexture, mRenderer);
// Crea un backbuffer para el renderizador
mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -156,12 +156,12 @@ void Instructions::run(Uint8 mode)
SDL_RenderClear(mRenderer);
// Escribe el texto
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 8, mTextStrings[11], 0, orangeColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 24, mTextStrings[12], 0, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 34, mTextStrings[13], 0, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 48, mTextStrings[14], 0, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 58, mTextStrings[15], 0, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 75, mTextStrings[16], 0, orangeColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 8, mTextStrings[11], 1, orangeColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 24, mTextStrings[12], 1, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 34, mTextStrings[13], 1, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 48, mTextStrings[14], 1, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 58, mTextStrings[15], 1, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, 75, mTextStrings[16], 1, orangeColor, 1, shdwTxtColor);
mText->writeShadowed(84, 92, mTextStrings[17], shdwTxtColor);
mText->writeShadowed(84, 108, mTextStrings[18], shdwTxtColor);
@@ -170,7 +170,7 @@ void Instructions::run(Uint8 mode)
mText->writeShadowed(84, 156, mTextStrings[21], shdwTxtColor);
if ((mode == INSTRUCTIONS_MODE_MANUAL) && (mCounter % 50 > 14))
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - 12, mTextStrings[22], 0, orangeColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - 12, mTextStrings[22], 1, orangeColor, 1, shdwTxtColor);
// Disquito
mSprite->init(destRect1, mItemTexture, mRenderer);

View File

@@ -103,7 +103,7 @@ void Item::init(Uint8 value, float x, float y, LTexture *texture, SDL_Renderer *
}
}
// Centra el globo en la posición X
// Centra el objeto en la posición X
void Item::allignTo(int x)
{
mPosX = float(x - (mWidth / 2));
@@ -125,7 +125,7 @@ void Item::allignTo(int x)
shiftColliders();
}
// Pinta el globo en la pantalla
// Pinta el objeto en la pantalla
void Item::render()
{
if (mEnabled)
@@ -141,7 +141,7 @@ void Item::render()
}
}
// Actualiza la posición y estados del globo
// Actualiza la posición y estados del objeto
void Item::move()
{
mStatus = 0;

View File

@@ -262,6 +262,13 @@ void MovingSprite::setRotateAmount(double value)
mRotateAmount = value;
}
// Establece el valor de la variable
void MovingSprite::disableRotate()
{
mRotate = false;
mAngle = 0;
}
// Actualiza las variables internas del objeto
void MovingSprite::update()
{

View File

@@ -127,6 +127,9 @@ public:
// Establece el valor de la variable
void setRotateAmount(double value);
// Quita el efecto de rotación y deja el sprite en su angulo inicial.
void disableRotate();
// Cambia el sentido de la rotación
void switchRotate();
};

View File

@@ -26,7 +26,7 @@ Title::Title(SDL_Window *window, SDL_Renderer *renderer, Input *input, std::stri
mDustBitmapL = new AnimatedSprite();
mDustBitmapR = new AnimatedSprite();
mTile = new Sprite();
mText = new Text(mFileList[46], mTextTexture, mRenderer);
mText = new Text(mFileList[48], mTextTexture, mRenderer);
mMenu.title = new Menu(mRenderer, mText, mInput, mFileList);
mMenu.options = new Menu(mRenderer, mText, mInput, mFileList);
@@ -531,6 +531,26 @@ section_t Title::run(Uint8 subsection)
}
}
// Actualiza el tileado de fondo
switch (mBackgroundMode)
{
case 0: // El tileado de fondo se desplaza en diagonal
mBackgroundWindow.x++;
mBackgroundWindow.x %= 64;
mBackgroundWindow.y++;
mBackgroundWindow.y %= 64;
break;
case 1: // El tileado de fondo se desplaza en circulo
++mBackgroundCounter %= 360;
mBackgroundWindow.x = 128 + (int(mSin[(mBackgroundCounter + 270) % 360] * 128));
mBackgroundWindow.y = 96 + (int(mSin[(360 - mBackgroundCounter) % 360] * 96));
break;
default:
break;
}
// Comprueba las entradas para el menu
if (mMenuVisible == true)
mMenu.active->checkInput();
@@ -616,27 +636,6 @@ section_t Title::run(Uint8 subsection)
// Limpia la pantalla
SDL_SetRenderDrawColor(mRenderer, bgColor.r, bgColor.g, bgColor.b, 255);
SDL_RenderClear(mRenderer);
// Pinta el tileado de fondo
switch (mBackgroundMode)
{
case 0: // El tileado de fondo se desplaza en diagonal
mBackgroundWindow.x++;
mBackgroundWindow.x %= 64;
mBackgroundWindow.y++;
mBackgroundWindow.y %= 64;
break;
case 1: // El tileado de fondo se desplaza en circulo
++mBackgroundCounter %= 360;
mBackgroundWindow.x = 128 + (int(mSin[(mBackgroundCounter + 270) % 360] * 128));
mBackgroundWindow.y = 96 + (int(mSin[(360 - mBackgroundCounter) % 360] * 96));
break;
default:
break;
}
SDL_RenderCopy(mRenderer, mBackground, &mBackgroundWindow, NULL);
// Dibuja los objetos
@@ -651,10 +650,10 @@ section_t Title::run(Uint8 subsection)
// PRESS ANY KEY!
if ((mCounter % 50 > 14) && (mMenuVisible == false))
mText->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, PLAY_AREA_THIRD_QUARTER_Y + BLOCK, mTextStrings[23], 0, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, PLAY_AREA_THIRD_QUARTER_Y + BLOCK, mTextStrings[23], 1, noColor, 1, shdwTxtColor);
// Texto con el copyright y versión
mText->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - (BLOCK * 2), TEXT_COPYRIGHT, 0, noColor, 1, shdwTxtColor);
mText->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - (BLOCK * 2), TEXT_COPYRIGHT, 1, noColor, 1, shdwTxtColor);
// Fade
mFade->render();