summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 9bf5d990..bcf3fb15 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -103,7 +103,8 @@ LocalPlayer::~LocalPlayer()
void LocalPlayer::logic()
{
- switch (mAction) {
+ switch (mAction)
+ {
case STAND:
break;
@@ -123,13 +124,36 @@ void LocalPlayer::logic()
break;
case ATTACK:
+ int rotation = 0;
+ std::string particleEffect = "";
int frames = 4;
+
if (mEquippedWeapon &&
mEquippedWeapon->getAttackType() == ACTION_ATTACK_BOW)
frames = 5;
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();