From bcbc10cb7c7628252da58b1d969858b33f1befb2 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Tue, 25 Jul 2023 21:34:38 +0000 Subject: [PATCH] Ranger should be the only one updating the ranger-specific shooting animation --- Crawler/Player.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index a01e14d8..18b3ab7c 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -544,16 +544,18 @@ void Player::SetVelocity(vf2d vel){ } void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){ - if(targetDirection<=PI/4&&targetDirection>-PI/4){ - UpdateAnimation(AnimationState::RANGER_SHOOT_E); - } else - if(targetDirection>=3*PI/4||targetDirection<-3*PI/4){ - UpdateAnimation(AnimationState::RANGER_SHOOT_W); - } else - if(targetDirection<=3*PI/4&&targetDirection>PI/4){ - UpdateAnimation(AnimationState::RANGER_SHOOT_S); - } else - if(targetDirection>=-3*PI/4&&targetDirection<-PI/4){ - UpdateAnimation(AnimationState::RANGER_SHOOT_N); + if(GetClass()==Class::RANGER){ + if(targetDirection<=PI/4&&targetDirection>-PI/4){ + UpdateAnimation(AnimationState::RANGER_SHOOT_E); + } else + if(targetDirection>=3*PI/4||targetDirection<-3*PI/4){ + UpdateAnimation(AnimationState::RANGER_SHOOT_W); + } else + if(targetDirection<=3*PI/4&&targetDirection>PI/4){ + UpdateAnimation(AnimationState::RANGER_SHOOT_S); + } else + if(targetDirection>=-3*PI/4&&targetDirection<-PI/4){ + UpdateAnimation(AnimationState::RANGER_SHOOT_N); + } } } \ No newline at end of file