Update knockback logic and formula again. Release Build 9177.

This commit is contained in:
sigonasr2 2024-05-03 07:49:20 -05:00
parent 8f02afb7bb
commit ef53d9852a
4 changed files with 10 additions and 4 deletions

View File

@ -838,7 +838,11 @@ geom2d::circle<float>Monster::Hitbox(){
} }
void Monster::Knockback(const vf2d&vel){ void Monster::Knockback(const vf2d&vel){
//A new angle will be applied, but will be constrained by whichever applied velocity is strongest (either the current velocity, or the new one). This prevents continuous uncapped velocities to knockbacks applied.
float maxVelThreshold=std::max(vel.mag(),this->vel.mag());
this->vel+=vel; this->vel+=vel;
float newVelAngle=this->vel.polar().y;
this->vel=vf2d{maxVelThreshold,newVelAngle}.cart();
} }
void Monster::Knockup(float duration){ void Monster::Knockup(float duration){

View File

@ -305,9 +305,11 @@ State::State Player::GetState(){
} }
void Player::Knockback(vf2d vel){ void Player::Knockback(vf2d vel){
if(!HasIframes()){ //A new angle will be applied, but will be constrained by whichever applied velocity is strongest (either the current velocity, or the new one). This prevents continuous uncapped velocities to knockbacks applied.
this->vel+=vel; float maxVelThreshold=std::max(vel.mag(),this->vel.mag());
} this->vel+=vel;
float newVelAngle=this->vel.polar().y;
this->vel=vf2d{maxVelThreshold,newVelAngle}.cart();
} }
void Player::Update(float fElapsedTime){ void Player::Update(float fElapsedTime){

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 9176 #define VERSION_BUILD 9177
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a