diff options
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r-- | src/particle/particle.cpp | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index b28e3a819..728433ae9 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -237,11 +237,19 @@ bool Particle::update() restrict2 { if (mAlive == AliveStatus::ALIVE) { - const Vector oldPos = mPos; - if (mLifetimeLeft == 0) { mAlive = AliveStatus::DEAD_TIMEOUT; + + if (mChildParticles.empty()) + { + if (mAlive != AliveStatus::ALIVE && + mAutoDelete) + { + return false; + } + return true; + } } else { @@ -289,24 +297,26 @@ bool Particle::update() restrict2 } mImage = mAnimation->getCurrentImage(); } + const Vector oldPos = mPos; + updateSelf(); - } - const Vector change = mPos - oldPos; - if (mChildParticles.empty()) - { - if (mAlive != AliveStatus::ALIVE && - mAutoDelete) + const Vector change = mPos - oldPos; + if (mChildParticles.empty()) { - return false; + if (mAlive != AliveStatus::ALIVE && + mAutoDelete) + { + return false; + } + return true; + } + for (ParticleIterator p = mChildMoveParticles.begin(), + fp2 = mChildMoveParticles.end(); p != fp2; ) + { + // move particle with its parent if desired + (*p)->moveBy(change); } - return true; - } - for (ParticleIterator p = mChildMoveParticles.begin(), - fp2 = mChildMoveParticles.end(); p != fp2; ) - { - // move particle with its parent if desired - (*p)->moveBy(change); } // Update child particles |