summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/particle.cpp6
-rw-r--r--src/textparticle.cpp17
2 files changed, 20 insertions, 3 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index bb28c873..579bbfc1 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -146,7 +146,6 @@ Particle::update()
{
if (mInvDieDistance > 0.0f && invHypotenuse > mInvDieDistance)
{
- logger->log("killed");
mAlive = false;
}
float accFactor = invHypotenuse * mAcceleration;
@@ -179,7 +178,8 @@ Particle::update()
if (mPosZ > PARTICLE_SKY || mPosZ < 0.0f)
{
- if (mBounce && fabs(mVectorZ) > mGravity * 2) {
+ if (mBounce > 0.0f)
+ {
mPosZ *= -mBounce;
mVectorX *= mBounce;
mVectorY *= mBounce;
@@ -326,6 +326,8 @@ Particle::addTextSplashEffect(std::string text, gcn::Font *font, gcn::Color colo
);
newParticle->setGravity(0.1f);
newParticle->setBounce(0.5f);
+ newParticle->setLifetime(200);
+ newParticle->setFadeOut(100);
mChildParticles.push_back(newParticle);
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index e7a0926b..2a2c50e8 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -42,7 +42,22 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
int screenX = (int)mPosX + offsetX;
int screenY = (int)mPosY - int(mPosZ) + offsetY;
+ int alpha = 255;
+
+ if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
+ {
+ alpha *= mLifetimeLeft;
+ alpha /= mFadeOut;
+ };
+
+ if (mLifetimePast < mFadeIn)
+ {
+ alpha *= mLifetimePast;
+ alpha /= mFadeIn;
+ }
+
graphics->setFont(mTextFont);
- graphics->setColor(mTextColor);
+ graphics->setColor(gcn::Color (mTextColor.r, mTextColor.g, mTextColor.b,
+ alpha));
graphics->drawText(mText, screenX, screenY, gcn::Graphics::CENTER);
}