Added Warrior swing sword animation

This commit is contained in:
2023-06-17 19:34:16 -05:00
parent 5be3d2679c
commit 4b98518fcf
7 changed files with 141 additions and 46 deletions
+28
View File
@@ -176,10 +176,38 @@ void Player::Update(float fElapsedTime){
}
if(closest!=nullptr&&closest->Hurt(atk)){
attack_cooldown_timer=ATTACK_COOLDOWN;
swordSwingTimer=0.2;
SetState(State::SWING_SWORD);
switch(facingDirection){
case DOWN:{
UpdateAnimation(AnimationState::SWINGSWORD_S);
}break;
case RIGHT:{
UpdateAnimation(AnimationState::SWINGSWORD_E);
}break;
case LEFT:{
UpdateAnimation(AnimationState::SWINGSWORD_W);
}break;
case UP:{
UpdateAnimation(AnimationState::SWINGSWORD_N);
}break;
}
}
}
}
float Player::GetSwordSwingTimer(){
return swordSwingTimer;
}
void Player::SetSwordSwingTimer(float val){
swordSwingTimer=val;
}
void Player::SetState(State newState){
state=newState;
}
vf2d Player::GetVelocity(){
return vel;
}