summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index 84161c9f..0c4a7d7e 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -393,6 +393,19 @@ void Particle::adjustEmitterSize(int w, int h)
}
}
+float Particle::getCurrentAlpha() const
+{
+ float alpha = mAlpha;
+
+ if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
+ alpha *= (float)mLifetimeLeft / (float)mFadeOut;
+
+ if (mLifetimePast < mFadeIn)
+ alpha *= (float)mLifetimePast / (float)mFadeIn;
+
+ return alpha;
+}
+
void Particle::setMap(Map *map)
{
mMap = map;