Ya se puede continuar al morir

This commit is contained in:
2022-10-04 21:40:33 +02:00
parent a5adf1ba01
commit 18c36ad3fb
9 changed files with 137 additions and 132 deletions

View File

@@ -210,7 +210,14 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
// Añade rotación al sprite
sprite->setRotate(false);
sprite->setRotateSpeed(0);
sprite->setRotateAmount(2.0);
if (velX > 0.0f)
{
sprite->setRotateAmount(2.0);
}
else
{
sprite->setRotateAmount(-2.0);
}
break;
@@ -258,15 +265,16 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
creationCounterIni = creationtimer;
popping = false;
// Actualiza valores
beingCreated = creationCounter == 0 ? false : true;
invulnerable = beingCreated == false ? false : true;
counter = 0;
travelY = 1.0f;
this->speed = speed;
// Tipo
this->kind = kind;
// Selecciona un frame para pintar
sprite->setSpriteClip(sprite->getAnimationClip(0, 0));
}
// Destructor
@@ -505,7 +513,6 @@ void Balloon::updateState()
{
disable();
}
}
// Si se está creando
@@ -552,28 +559,32 @@ void Balloon::updateState()
if (kind == POWER_BALL)
{
sprite->setRotate(true);
if (velX > 0.0f)
{
sprite->setRotateAmount(2.0);
}
else
{
sprite->setRotateAmount(-2.0);
}
}
}
}
// Solo comprueba el estado detenido cuando no se está creando
else if (isStopped())
{
// Si está detenido, reduce el contador
// Si es una powerball deja de rodar
if (kind == POWER_BALL)
{
sprite->setRotate(false);
}
// Reduce el contador
if (stoppedCounter > 0)
{
stoppedCounter--;
}
// Si el contador ha llegado a cero, ya no está detenido
// Quitarles el estado "detenido" si no estan explosionando
else if (!isPopping())
{ // Quitarles el estado "detenido" si no estan explosionando
{
// Si es una powerball vuelve a rodar
if (kind == POWER_BALL)
{
sprite->setRotate(true);
}
setStop(false);
}
}
@@ -680,7 +691,7 @@ Uint8 Balloon::getClass()
{
return BALLOON_CLASS;
}
else if ((kind >= HEXAGON_1) && (kind <= HEXAGON_4))
{
return HEXAGON_CLASS;