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]
name=powerball
speed=20
speed=10
loop=0
frames=48
[/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
int index = 0;
while (index < source->size())
while (index < (int)source->size())
{
// Lee desde el vector
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
mSprite->setRotate(false);
mSprite->setRotateSpeed(1);
mSprite->setRotateSpeed(0);
mSprite->setRotateAmount(2.0);
break;
@@ -299,6 +299,8 @@ void Balloon::render()
if ((mVisible) && (mEnabled))
{
if (mBouncing.enabled)
{
if (mKind != POWER_BALL)
{
// Aplica desplazamiento para el zoom
mSprite->setPosX(getPosX() + mBouncing.despX);
@@ -307,17 +309,24 @@ void Balloon::render()
mSprite->setPosX(getPosX() - mBouncing.despX);
mSprite->setPosY(getPosY() - mBouncing.despY);
}
}
else if (isBeingCreated())
{
// Aplica alpha blending
mSprite->getTexture()->setAlpha(255 - (int)((float)mCreationCounter * (255.0f / (float)mCreationCounterIni)));
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);
}
else
{
mSprite->render();
}
if (mKind == POWER_BALL)
{
@@ -328,6 +337,7 @@ void Balloon::render()
}
}
}
}
// Actualiza la posición y estados del globo
void Balloon::move()
@@ -351,8 +361,11 @@ void Balloon::move()
mSprite->switchRotate();
// Activa el efecto de rebote
if (mKind != POWER_BALL)
{
bounceStart();
}
}
// Mueve el globo hacia arriba o hacia abajo
mPosY += (mVelY * mSpeed);
@@ -367,8 +380,11 @@ void Balloon::move()
mVelY = -mVelY;
// Activa el efecto de rebote
if (mKind != POWER_BALL)
{
bounceStart();
}
}
// Si el globo se sale por la parte inferior
if (mPosY + mHeight > PLAY_AREA_BOTTOM)
@@ -380,8 +396,11 @@ void Balloon::move()
mVelY = -mDefaultVelY;
// Activa el efecto de rebote
if (mKind != POWER_BALL)
{
bounceStart();
}
}
/*

View File

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

View File

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