Make 4-way directional facing directions updating a bit more lenient. Framework for boss arrow indicators when bosses go off-screen. Release Build 9382.

This commit is contained in:
sigonasr2 2024-05-22 09:12:35 -05:00
parent 6902852b51
commit 4720f59ba7
7 changed files with 19 additions and 2 deletions

View File

@ -378,7 +378,7 @@ void Monster::UpdateFacingDirection(vf2d facingTargetPoint){
float facingAngle=util::angleTo(GetPos(),facingTargetPoint); float facingAngle=util::angleTo(GetPos(),facingTargetPoint);
vf2d diff=GetPos()-facingTargetPoint; vf2d diff=GetPos()-facingTargetPoint;
if(abs(facingAngle-prevFacingDirectionAngle)<(7*PI)/16.f||lastFacingDirectionChange<0.25f)return; //We don't want to change facing angle until a more drastic angle of change has occurred. About 1/4 circle should be acceptable. if(abs(facingAngle-prevFacingDirectionAngle)<PI/4.f||lastFacingDirectionChange<0.25f)return; //We don't want to change facing angle until a more drastic angle of change has occurred. About 1/4 circle should be acceptable.
prevFacingDirectionAngle=facingAngle; prevFacingDirectionAngle=facingAngle;
lastFacingDirectionChange=0.f; lastFacingDirectionChange=0.f;
@ -1071,4 +1071,8 @@ void Monster::SetIframes(const float iframeTime){
const std::string_view Monster::GetDisplayName()const{ const std::string_view Monster::GetDisplayName()const{
return MONSTER_DATA.at(GetName()).GetDisplayName(); return MONSTER_DATA.at(GetName()).GetDisplayName();
}
const bool Monster::HasArrowIndicator()const{
return MONSTER_DATA.at(GetName()).HasArrowIndicator();
} }

View File

@ -175,6 +175,7 @@ public:
const float GetCollisionRadius()const; const float GetCollisionRadius()const;
const bool IsDead()const; const bool IsDead()const;
const std::string_view GetDisplayName()const; const std::string_view GetDisplayName()const;
const bool HasArrowIndicator()const;
private: private:
//NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!! //NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!!
// The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop. // The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop.

View File

@ -187,6 +187,7 @@ void MonsterData::InitializeMonsterData(){
monster.collisionRadius=8; monster.collisionRadius=8;
if(DATA["Monsters"][MonsterName].HasProperty("Collision Radius"))monster.collisionRadius=DATA["Monsters"][MonsterName]["Collision Radius"].GetReal(); if(DATA["Monsters"][MonsterName].HasProperty("Collision Radius"))monster.collisionRadius=DATA["Monsters"][MonsterName]["Collision Radius"].GetReal();
if(DATA["Monsters"][MonsterName].HasProperty("ShowBossIndicator"))monster.hasArrowIndicator=DATA["Monsters"][MonsterName]["ShowBossIndicator"].GetBool();
if(hasFourWaySpriteSheet)monster.SetUsesFourWaySprites(); if(hasFourWaySpriteSheet)monster.SetUsesFourWaySprites();
@ -437,4 +438,7 @@ const std::optional<float>MonsterData::GetLifetime()const{
} }
const float MonsterData::GetCollisionRadius()const{ const float MonsterData::GetCollisionRadius()const{
return collisionRadius; return collisionRadius;
}
const bool MonsterData::HasArrowIndicator()const{
return hasArrowIndicator;
} }

View File

@ -101,6 +101,7 @@ public:
const std::optional<float>GetLifetime()const; const std::optional<float>GetLifetime()const;
//If an object has a collision radius, returns it. //If an object has a collision radius, returns it.
const float GetCollisionRadius()const; const float GetCollisionRadius()const;
const bool HasArrowIndicator()const;
private: private:
std::string name; std::string name;
int hp; int hp;
@ -129,4 +130,5 @@ private:
bool invulnerable{false}; bool invulnerable{false};
std::optional<float>lifetime{}; std::optional<float>lifetime{};
float collisionRadius{}; float collisionRadius{};
bool hasArrowIndicator{false};
}; };

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 9381 #define VERSION_BUILD 9382
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -222,6 +222,9 @@ Monsters
XP = 150 XP = 150
# A flag to show an arrow indicator when the boss is off-screen.
ShowBossIndicator = True
Strategy = Slime King Strategy = Slime King
StartPhase = 1 StartPhase = 1
@ -898,6 +901,9 @@ Monsters
XP = 5 XP = 5
# A flag to show an arrow indicator when the boss is off-screen.
ShowBossIndicator = True
Strategy = Zephy Strategy = Zephy
#Size of each animation frame #Size of each animation frame