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;
@@ -254,8 +254,8 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
mVisible = true; mVisible = true;
mInvulnerable = true; mInvulnerable = true;
mBeingCreated = true; mBeingCreated = true;
mCreationCounter = creationtimer; mCreationCounter = creationtimer;
mCreationCounterIni = creationtimer; mCreationCounterIni = creationtimer;
mPopping = false; mPopping = false;
mCounter = 0; mCounter = 0;
@@ -300,31 +300,41 @@ void Balloon::render()
{ {
if (mBouncing.enabled) if (mBouncing.enabled)
{ {
// Aplica desplazamiento para el zoom if (mKind != POWER_BALL)
mSprite->setPosX(getPosX() + mBouncing.despX); {
mSprite->setPosY(getPosY() + mBouncing.despY); // Aplica desplazamiento para el zoom
mSprite->render(); mSprite->setPosX(getPosX() + mBouncing.despX);
mSprite->setPosX(getPosX() - mBouncing.despX); mSprite->setPosY(getPosY() + mBouncing.despY);
mSprite->setPosY(getPosY() - mBouncing.despY); mSprite->render();
mSprite->setPosX(getPosX() - mBouncing.despX);
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)
{ {
Sprite *sp = new Sprite(mSprite->getRect() ,mSprite->getTexture(),mSprite->getRenderer()); Sprite *sp = new Sprite(mSprite->getRect(), mSprite->getTexture(), mSprite->getRenderer());
sp->setSpriteClip(370,148,37,37); sp->setSpriteClip(370, 148, 37, 37);
sp->render(); sp->render();
delete sp; delete sp;
}
} }
} }
} }
@@ -351,7 +361,10 @@ void Balloon::move()
mSprite->switchRotate(); mSprite->switchRotate();
// Activa el efecto de rebote // Activa el efecto de rebote
bounceStart(); if (mKind != POWER_BALL)
{
bounceStart();
}
} }
// Mueve el globo hacia arriba o hacia abajo // Mueve el globo hacia arriba o hacia abajo
@@ -367,7 +380,10 @@ void Balloon::move()
mVelY = -mVelY; mVelY = -mVelY;
// Activa el efecto de rebote // Activa el efecto de rebote
bounceStart(); if (mKind != POWER_BALL)
{
bounceStart();
}
} }
// Si el globo se sale por la parte inferior // Si el globo se sale por la parte inferior
@@ -380,7 +396,10 @@ void Balloon::move()
mVelY = -mDefaultVelY; mVelY = -mDefaultVelY;
// Activa el efecto de rebote // Activa el efecto de rebote
bounceStart(); if (mKind != POWER_BALL)
{
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);
} }