diff options
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 18f25257..44187a75 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -104,7 +104,8 @@ LocalPlayer::~LocalPlayer() void LocalPlayer::logic() { - switch (mAction) { + switch (mAction) + { case STAND: break; @@ -124,13 +125,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 && 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(); |