diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-06 10:38:07 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-06 10:38:07 +0100 |
commit | 7cbdab589491e007adacd7597c769cdb9308a32c (patch) | |
tree | 0269c37cccbed49a1cb15db9de816f39ef549189 /src/player.cpp | |
parent | 616afb27c23def5661b3466d6fc86fd1c65c0082 (diff) | |
parent | aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5 (diff) | |
download | mana-7cbdab589491e007adacd7597c769cdb9308a32c.tar.gz mana-7cbdab589491e007adacd7597c769cdb9308a32c.tar.bz2 mana-7cbdab589491e007adacd7597c769cdb9308a32c.tar.xz mana-7cbdab589491e007adacd7597c769cdb9308a32c.zip |
Merge branch 'aethyra/master'
Conflicts:
src/being.cpp
src/being.h
src/floor_item.cpp
src/floor_item.h
src/flooritemmanager.cpp
src/gui/inventorywindow.cpp
src/gui/inventorywindow.h
src/gui/itemcontainer.cpp
src/gui/popupmenu.cpp
src/net/beinghandler.cpp
src/npc.cpp
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 f620e637..e1928280 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -21,6 +21,7 @@ #include "animatedsprite.h" #include "game.h" +#include "particle.h" #include "player.h" #include "text.h" @@ -90,7 +91,10 @@ void Player::logic() break; case ATTACK: + int rotation = 0; + std::string particleEffect = ""; int frames = 4; + if (mEquippedWeapon && mEquippedWeapon->getAttackType() == ACTION_ATTACK_BOW) { @@ -99,6 +103,26 @@ void Player::logic() mFrame = (get_elapsed_time(mWalkTime) * frames) / mAttackSpeed; + //attack particle effect + if (mEquippedWeapon) + particleEffect = mEquippedWeapon->getParticleEffect(); + + if (!particleEffect.empty() && mParticleEffects && mFrame == 1) + { + 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(); |