summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index fd45430c..3b3f5116 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -63,6 +63,7 @@ Particle::Particle(Map *map):
mGravity(0.0f),
mRandomnes(0),
mBounce(0.0f),
+ mFollow(false),
mTarget(NULL),
mAcceleration(0.0f),
mInvDieDistance(-1.0f),
@@ -95,6 +96,8 @@ Particle::update()
mAlive = false;
}
+ Vector oldPos = mPos;
+
if (mAlive)
{
//calculate particle movement
@@ -191,10 +194,19 @@ Particle::update()
}
}
+ Vector change = mPos - oldPos;
+
// Update child particles
+
for (ParticleIterator p = mChildParticles.begin();
p != mChildParticles.end();)
{
+ //move particle with its parent if desired
+ if ((*p)->doesFollow())
+ {
+ (*p)->moveBy(change);
+ }
+ //update particle
if ((*p)->update())
{
p++;