1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

Do not restart DamageSprite scale interpolation when healed

This commit is contained in:
fgenesis 2016-05-25 02:11:20 +02:00
parent 589e5a90d4
commit 82c2122774

View file

@ -950,11 +950,12 @@ void Avatar::updateHair(float dt)
void Avatar::updateDamageVisualEffects()
{
int damageThreshold = float(maxHealth/5.0f)*3.0f;
Quad *damageSprite = dsq->game->damageSprite;
if (health <= damageThreshold)
{
//dsq->game->damageSprite->alpha.interpolateTo(0.9, 0.5);
float a = ((damageThreshold - health)/float(damageThreshold))*1.0f;
dsq->game->damageSprite->alpha.interpolateTo(a, 0.3);
damageSprite->alpha.interpolateTo(a, 0.3);
/*
std::ostringstream os;
@ -962,8 +963,11 @@ void Avatar::updateDamageVisualEffects()
debugLog(os.str());
*/
dsq->game->damageSprite->scale = Vector(1,1);
dsq->game->damageSprite->scale.interpolateTo(Vector(1.2, 1.2), 0.5, -1, 1);
if(!damageSprite->scale.isInterpolating())
{
damageSprite->scale = Vector(1,1);
damageSprite->scale.interpolateTo(Vector(1.2, 1.2), 0.5, -1, 1);
}
/*
if (health <= 0)
@ -974,7 +978,7 @@ void Avatar::updateDamageVisualEffects()
}
else
{
dsq->game->damageSprite->alpha.interpolateTo(0, 0.3);
damageSprite->alpha.interpolateTo(0, 0.3);
}
}