This commit is contained in:
learn_more 2013-09-15 04:19:43 +02:00
commit 64a5389e99

View File

@ -696,12 +696,13 @@ namespace spades {
break; break;
} }
hurtSprites.resize(12);
float hpper = player->GetHealth() / 100.f; float hpper = player->GetHealth() / 100.f;
int cnt = 18 - (int)(player->GetHealth() / 100.f * 8.f);
hurtSprites.resize(std::max(cnt, 6));
for(size_t i = 0; i < hurtSprites.size(); i++) { for(size_t i = 0; i < hurtSprites.size(); i++) {
HurtSprite& spr = hurtSprites[i]; HurtSprite& spr = hurtSprites[i];
spr.angle = GetRandom() * (2.f * M_PI); spr.angle = GetRandom() * (2.f * M_PI);
spr.scale = .2f + GetRandom() * .6f; spr.scale = .2f + GetRandom() * GetRandom() * .7f;
spr.horzShift = GetRandom(); spr.horzShift = GetRandom();
spr.strength = .3f + GetRandom() * .7f; spr.strength = .3f + GetRandom() * .7f;
if(hpper > .5f) { if(hpper > .5f) {
@ -2949,7 +2950,7 @@ namespace spades {
} }
void Client::DrawHurtSprites() { void Client::DrawHurtSprites() {
float per = (world->GetTime() - lastHurtTime) / .6f; float per = (world->GetTime() - lastHurtTime) / 1.5f;
if(per > 1.f) return; if(per > 1.f) return;
if(per < 0.f) return; if(per < 0.f) return;
Handle<IImage> img = renderer->RegisterImage("Gfx/HurtSprite.png"); Handle<IImage> img = renderer->RegisterImage("Gfx/HurtSprite.png");