Update knockback logic and formula again. Release Build 9177.

mac-build
sigonasr2 7 months ago
parent 8f02afb7bb
commit ef53d9852a
  1. 4
      Adventures in Lestoria/Monster.cpp
  2. 8
      Adventures in Lestoria/Player.cpp
  3. 2
      Adventures in Lestoria/Version.h
  4. BIN
      x64/Release/Adventures in Lestoria.exe

@ -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){

@ -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){

@ -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

Loading…
Cancel
Save