diff --git a/Crawler/Class.cpp b/Crawler/Class.cpp index ff466172..45c42ef2 100644 --- a/Crawler/Class.cpp +++ b/Crawler/Class.cpp @@ -60,6 +60,28 @@ Warrior::Warrior(std::string name,Class cl,Ability rightClickAbility,Ability abi {} void Warrior::Update(float fElapsedTime){ + ACCESS_PLAYER + if(p.GetState()==State::SWING_SWORD){ + switch(p.GetFacingDirection()){ + case UP:{ + p.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_N); + }break; + case DOWN:{ + p.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_S); + }break; + case LEFT:{ + p.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_W); + }break; + case RIGHT:{ + p.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_E); + }break; + } + p.SetSwordSwingTimer(p.GetSwordSwingTimer()-fElapsedTime); + if(p.GetSwordSwingTimer()<=0){ + p.SetSwordSwingTimer(0); + p.SetState(State::NORMAL); + } + } } bool Warrior::AutoAttack(){ @@ -277,6 +299,22 @@ void Wizard::Update(float fElapsedTime){ CLASS_DATA[cl]->walk_s=AnimationState::WIZARD_WALK_S; CLASS_DATA[cl]->walk_w=AnimationState::WIZARD_WALK_W; } + if(p.GetState()==State::CASTING){ + switch(p.GetFacingDirection()){ + case UP:{ + p.UpdateAnimation(AnimationState::WIZARD_CAST_N); + }break; + case DOWN:{ + p.UpdateAnimation(AnimationState::WIZARD_CAST_S); + }break; + case LEFT:{ + p.UpdateAnimation(AnimationState::WIZARD_CAST_W); + }break; + case RIGHT:{ + p.UpdateAnimation(AnimationState::WIZARD_CAST_E); + }break; + } + } } bool Wizard::AutoAttack(){ diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 1152e9a2..957c087b 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -286,47 +286,6 @@ void Crawler::HandleUserInput(float fElapsedTime){ } } - if(player.GetState()==State::SWING_SWORD){ - setIdleAnimation=false; - switch(player.GetFacingDirection()){ - case UP:{ - player.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_N); - }break; - case DOWN:{ - player.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_S); - }break; - case LEFT:{ - player.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_W); - }break; - case RIGHT:{ - player.UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_E); - }break; - } - player.SetSwordSwingTimer(player.GetSwordSwingTimer()-fElapsedTime); - if(player.GetSwordSwingTimer()<=0){ - player.SetSwordSwingTimer(0); - player.SetState(State::NORMAL); - } - } - - if(player.GetState()==State::CASTING){ - setIdleAnimation=false; - switch(player.GetFacingDirection()){ - case UP:{ - player.UpdateAnimation(AnimationState::WIZARD_CAST_N); - }break; - case DOWN:{ - player.UpdateAnimation(AnimationState::WIZARD_CAST_S); - }break; - case LEFT:{ - player.UpdateAnimation(AnimationState::WIZARD_CAST_W); - }break; - case RIGHT:{ - player.UpdateAnimation(AnimationState::WIZARD_CAST_E); - }break; - } - } - if(player.GetState()!=State::NORMAL){ setIdleAnimation=false; } diff --git a/Crawler/Version.h b/Crawler/Version.h index 076b2295..a570bebf 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 661 +#define VERSION_BUILD 662 #define stringify(a) stringify_(a) #define stringify_(a) #a