summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp24
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();