Retocado el borde de la powerball y quitados los efectos de rebote

This commit is contained in:
2022-10-04 16:58:10 +02:00
parent 9f93de1d06
commit 5fd1ffa865
6 changed files with 47 additions and 24 deletions

View File

@@ -31,7 +31,7 @@ frames=36,37,38,39,40,41,42,43,44,45
[animation] [animation]
name=powerball name=powerball
speed=20 speed=10
loop=0 loop=0
frames=48 frames=48
[/animation] [/animation]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -325,7 +325,7 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
// Recorre todo el vector // Recorre todo el vector
int index = 0; int index = 0;
while (index < source->size()) while (index < (int)source->size())
{ {
// Lee desde el vector // Lee desde el vector
line = source->at(index); line = source->at(index);

View File

@@ -209,7 +209,7 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
// Añade rotación al sprite // Añade rotación al sprite
mSprite->setRotate(false); mSprite->setRotate(false);
mSprite->setRotateSpeed(1); mSprite->setRotateSpeed(0);
mSprite->setRotateAmount(2.0); mSprite->setRotateAmount(2.0);
break; break;
@@ -299,6 +299,8 @@ void Balloon::render()
if ((mVisible) && (mEnabled)) if ((mVisible) && (mEnabled))
{ {
if (mBouncing.enabled) if (mBouncing.enabled)
{
if (mKind != POWER_BALL)
{ {
// Aplica desplazamiento para el zoom // Aplica desplazamiento para el zoom
mSprite->setPosX(getPosX() + mBouncing.despX); mSprite->setPosX(getPosX() + mBouncing.despX);
@@ -307,17 +309,24 @@ void Balloon::render()
mSprite->setPosX(getPosX() - mBouncing.despX); mSprite->setPosX(getPosX() - mBouncing.despX);
mSprite->setPosY(getPosY() - mBouncing.despY); mSprite->setPosY(getPosY() - mBouncing.despY);
} }
}
else if (isBeingCreated()) else if (isBeingCreated())
{ {
// Aplica alpha blending // Aplica alpha blending
mSprite->getTexture()->setAlpha(255 - (int)((float)mCreationCounter * (255.0f / (float)mCreationCounterIni))); mSprite->getTexture()->setAlpha(255 - (int)((float)mCreationCounter * (255.0f / (float)mCreationCounterIni)));
mSprite->render(); mSprite->render();
if (mKind == POWER_BALL)
{
Sprite *sp = new Sprite(mSprite->getRect(), mSprite->getTexture(), mSprite->getRenderer());
sp->setSpriteClip(370, 148, 37, 37);
sp->render();
delete sp;
}
mSprite->getTexture()->setAlpha(255); mSprite->getTexture()->setAlpha(255);
} }
else else
{ {
mSprite->render(); mSprite->render();
}
if (mKind == POWER_BALL) if (mKind == POWER_BALL)
{ {
@@ -328,6 +337,7 @@ void Balloon::render()
} }
} }
} }
}
// Actualiza la posición y estados del globo // Actualiza la posición y estados del globo
void Balloon::move() void Balloon::move()
@@ -351,8 +361,11 @@ void Balloon::move()
mSprite->switchRotate(); mSprite->switchRotate();
// Activa el efecto de rebote // Activa el efecto de rebote
if (mKind != POWER_BALL)
{
bounceStart(); bounceStart();
} }
}
// Mueve el globo hacia arriba o hacia abajo // Mueve el globo hacia arriba o hacia abajo
mPosY += (mVelY * mSpeed); mPosY += (mVelY * mSpeed);
@@ -367,8 +380,11 @@ void Balloon::move()
mVelY = -mVelY; mVelY = -mVelY;
// Activa el efecto de rebote // Activa el efecto de rebote
if (mKind != POWER_BALL)
{
bounceStart(); bounceStart();
} }
}
// Si el globo se sale por la parte inferior // Si el globo se sale por la parte inferior
if (mPosY + mHeight > PLAY_AREA_BOTTOM) if (mPosY + mHeight > PLAY_AREA_BOTTOM)
@@ -380,8 +396,11 @@ void Balloon::move()
mVelY = -mDefaultVelY; mVelY = -mDefaultVelY;
// Activa el efecto de rebote // Activa el efecto de rebote
if (mKind != POWER_BALL)
{
bounceStart(); bounceStart();
} }
}
/* /*

View File

@@ -15,7 +15,7 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
// Pasa variables // Pasa variables
mDemo.enabled = demo; mDemo.enabled = demo;
mNumPlayers = numPlayers; mNumPlayers = numPlayers;
mCurrentStage = currentStage; mCurrentStage = 4;//currentStage;
mLastStageReached = currentStage; mLastStageReached = currentStage;
if (mNumPlayers == 1) if (mNumPlayers == 1)
{ {
@@ -2695,7 +2695,7 @@ void Game::update()
// Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos // Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos
if (!mGameCompleted) if (!mGameCompleted)
{ {
updateMenace(); //updateMenace();
} }
// Actualiza la velocidad de los enemigos // Actualiza la velocidad de los enemigos

View File

@@ -251,7 +251,11 @@ void MovingSprite::rotate()
if (enabled) if (enabled)
if (rotateEnabled) if (rotateEnabled)
{ {
if (counter % rotateSpeed == 0) if (rotateSpeed == 0)
{
incAngle(rotateAmount);
}
else if (counter % rotateSpeed == 0)
{ {
incAngle(rotateAmount); incAngle(rotateAmount);
} }