diff options
author | Ira Rice <irarice@gmail.com> | 2009-03-02 19:10:40 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-03-02 19:10:40 -0700 |
commit | 1d7b4c4640635c809feca83e76b1aa62109c0707 (patch) | |
tree | 0d715bfc941e72a6df3779d53c6c2e53729366e3 /src/player.cpp | |
parent | 4adee3cfbafee155ab9223e94162c6055ef0a412 (diff) | |
download | mana-1d7b4c4640635c809feca83e76b1aa62109c0707.tar.gz mana-1d7b4c4640635c809feca83e76b1aa62109c0707.tar.bz2 mana-1d7b4c4640635c809feca83e76b1aa62109c0707.tar.xz mana-1d7b4c4640635c809feca83e76b1aa62109c0707.zip |
Added particle attacks back on to the players. However, instead of being
constant, particle attacks are now weapon specific, so that different
weapons can have different attacks.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/player.cpp b/src/player.cpp index 4d5ef171..16f810ad 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -22,6 +22,7 @@ #include "animatedsprite.h" #include "game.h" +#include "particle.h" #include "player.h" #include "text.h" @@ -91,7 +92,10 @@ void Player::logic() break; case ATTACK: + int rotation = 0; + std::string particleEffect = ""; int frames = 4; + if (mEquippedWeapon && mEquippedWeapon->getAttackType() == ACTION_ATTACK_BOW) { @@ -100,6 +104,26 @@ void Player::logic() mFrame = (get_elapsed_time(mWalkTime) * frames) / mAttackSpeed; + //attack particle effect + if (mEquippedWeapon) + particleEffect = mEquippedWeapon->getParticleEffect(); + + if (!particleEffect.empty() && mParticleEffects) + { + switch (mDirection) + { + case DOWN: rotation = 0; break; + case LEFT: rotation = 90; break; + case UP: rotation = 180; break; + case RIGHT: rotation = 270; break; + default: break; + } + Particle *p; + p = particleEngine->addEffect("graphics/particles/" + + particleEffect, 0, 0, rotation); + controlParticle(p); + } + if (mFrame >= frames) nextStep(); |