@ -621,6 +621,19 @@ void Player::Update(float fElapsedTime){
}
}
}
}
# pragma endregion
# pragma endregion
# pragma region Handle knockup timers
if ( knockUpTimer > 0.f ) {
knockUpTimer = std : : max ( 0.f , knockUpTimer - fElapsedTime ) ;
if ( knockUpTimer = = 0.f ) {
totalKnockupTime = 0.f ;
knockUpZAmt = 0.f ;
SetZ ( 0.f ) ;
} else {
SetZ ( util : : lerp ( 0.f , 1.f , - ( pow ( ( knockUpTimer - totalKnockupTime / 2 ) / ( totalKnockupTime / 2 ) , 2 ) ) + 1 ) * knockUpZAmt ) ;
}
}
# pragma endregion
}
}
float Player : : GetSwordSwingTimer ( ) {
float Player : : GetSwordSwingTimer ( ) {
@ -643,7 +656,7 @@ vf2d Player::GetVelocity(){
}
}
bool Player : : CanMove ( ) {
bool Player : : CanMove ( ) {
return state ! = State : : ANIMATION_LOCK & & ( state ! = State : : CASTING | | ( castInfo . castTotalTime - castInfo . castTimer > 0.2f ) ) ;
return knockUpTimer = = 0.f & & state ! = State : : ANIMATION_LOCK & & ( state ! = State : : CASTING | | ( castInfo . castTotalTime - castInfo . castTimer > 0.2f ) ) ;
}
}
bool Player : : CanAct ( ) {
bool Player : : CanAct ( ) {
@ -652,7 +665,7 @@ bool Player::CanAct(){
}
}
bool Player : : CanAct ( Ability & ability ) {
bool Player : : CanAct ( Ability & ability ) {
return ! ability . waitForRelease & & ( ability . canCancelCast | | state ! = State : : CASTING ) & & state ! = State : : ANIMATION_LOCK & & GameState : : STATE = = GameState : : states [ States : : GAME_RUN ] ;
return knockUpTimer = = 0 & & ! ability . waitForRelease & & ( ability . canCancelCast | | state ! = State : : CASTING ) & & state ! = State : : ANIMATION_LOCK & & GameState : : STATE = = GameState : : states [ States : : GAME_RUN ] ;
}
}
bool Player : : HasIframes ( ) {
bool Player : : HasIframes ( ) {
@ -1226,4 +1239,10 @@ void EntityStats::Reset(){
geom2d : : circle < float > Player : : Hitbox ( ) {
geom2d : : circle < float > Player : : Hitbox ( ) {
return { GetPos ( ) , 12 * GetSizeMult ( ) / 2 } ;
return { GetPos ( ) , 12 * GetSizeMult ( ) / 2 } ;
}
void Player : : Knockup ( float duration ) {
knockUpTimer + = duration ;
totalKnockupTime + = duration ;
knockUpZAmt + = 32 * pow ( duration , 2 ) ;
}
}