diff options
author | Philipp Sehmisch <mana@crushnet.org> | 2010-10-17 17:15:21 +0200 |
---|---|---|
committer | Philipp Sehmisch <mana@crushnet.org> | 2010-10-17 17:15:21 +0200 |
commit | 1b21442b5eb6dcc41a585715d07c73ed3ad59a1b (patch) | |
tree | c84f226695e1d7bb7d95fcba7c9e8c30333508da /src/being.cpp | |
parent | 1f3c056323de16cbe5965e1d65a69eeab73396ce (diff) | |
download | mana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.tar.gz mana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.tar.bz2 mana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.tar.xz mana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.zip |
Added death effects to particle engine.
Every particle can now have a death effect. This is an effect which
is created when the particle dies. Which death reasons (timeout,
touching floor, touching sky, reaching target or deleted by external
call) trigger the effect can also be specified. This is useful for
exploding projectiles and many other effects.
Reviewed-by: Bertram
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/being.cpp b/src/being.cpp index 138e5c5a..20225f47 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -530,19 +530,20 @@ void Being::fireMissile(Being *victim, const std::string &particle) if (!victim || particle.empty()) return; - Particle *target = particleEngine->createChild(); - Particle *missile = target->addEffect(particle, getPixelX(), getPixelY()); + Particle *missile = particleEngine->addEffect(particle, getPixelX(), getPixelY()); if (missile) { - target->setLifetime(2000); + Particle *target = particleEngine->createChild(); target->moveBy(Vector(0.0f, 0.0f, 32.0f)); + target->setLifetime(1000); victim->controlParticle(target); missile->setDestination(target, 7, 0); missile->setDieDistance(8); missile->setLifetime(900); } + } void Being::setAction(Action action, int attackType) @@ -582,7 +583,7 @@ void Being::setAction(Action action, int attackType) { switch (mSpriteDirection) { - case DIRECTION_DOWN: rotation = 0; break; + case DIRECTION_DOWN: rotation = 0; break; case DIRECTION_LEFT: rotation = 90; break; case DIRECTION_UP: rotation = 180; break; case DIRECTION_RIGHT: rotation = 270; break; |