Added low health warning visuals and sound effect. Release Build 8145.
This commit is contained in:
parent
0484908b37
commit
9133ab9e94
@ -1696,12 +1696,21 @@ void AiL::RenderHud(){
|
||||
RenderCastbar(CastInfo{"Exiting Level...",GetPlayer()->GetEndZoneStandTime(),"Player.End Zone Wait Time"_F});
|
||||
}
|
||||
|
||||
Pixel healthOutlineCol=BLACK;
|
||||
if(player->GetHealth()/player->GetMaxHealth()<="Player.Health Warning Pct"_F/100.f){
|
||||
float runTimeAmt=fmod(GetRuntime(),"Player.Health Warning Flicker Time"_F*2);
|
||||
if(runTimeAmt<"Player.Health Warning Flicker Time"_F){
|
||||
healthOutlineCol="Player.Health Warning Outline Color"_Pixel;
|
||||
}
|
||||
}
|
||||
|
||||
DrawDecal({2,2},GFX["heart_outline.png"].Decal(),{1.f,1.f},healthOutlineCol);
|
||||
DrawDecal({2,2},GFX["heart.png"].Decal());
|
||||
DrawDecal({2,20},GFX["mana.png"].Decal());
|
||||
std::string text=player->GetHealth()>0?std::to_string(healthCounter.GetDisplayValue()):"X";
|
||||
std::string text_mana=std::to_string(manaCounter.GetDisplayValue());
|
||||
|
||||
DrawShadowStringPropDecal({20,3},text,healthCounter.GetDisplayColor(),BLACK,{2,2},INFINITE);
|
||||
DrawShadowStringPropDecal({20,3},text,healthCounter.GetDisplayColor(),healthOutlineCol,{2,2},INFINITE);
|
||||
DrawShadowStringPropDecal({24,23},text_mana,manaCounter.GetDisplayColor(),BLACK,{1.5f,1.5f},INFINITE);
|
||||
|
||||
#pragma region Show Max Health/Max Mana
|
||||
@ -1710,7 +1719,7 @@ void AiL::RenderHud(){
|
||||
|
||||
std::string maxHealthText="/"+std::to_string(int(player->GetMaxHealth()));
|
||||
float maxHealthTextHeight=GetTextSizeProp(maxHealthText).y;
|
||||
DrawShadowStringPropDecal(vf2d{20,3}+healthTextSize+vf2d{1.f,-maxHealthTextHeight},maxHealthText,{200,200,200,255},BLACK,{1.f,1.f},INFINITE);
|
||||
DrawShadowStringPropDecal(vf2d{20,3}+healthTextSize+vf2d{1.f,-maxHealthTextHeight},maxHealthText,{200,200,200,255},healthOutlineCol,{1.f,1.f},INFINITE);
|
||||
}
|
||||
if(GameSettings::ShowMaxMana()){
|
||||
vf2d manaTextSize=GetTextSizeProp(text_mana)*vf2d{1.5f,1.5f};
|
||||
|
@ -293,6 +293,7 @@ void Player::Update(float fElapsedTime){
|
||||
notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime);
|
||||
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
|
||||
lastPathfindingCooldown=std::max(0.f,lastPathfindingCooldown-fElapsedTime);
|
||||
lowHealthSoundPlayedTimer=std::max(0.f,lowHealthSoundPlayedTimer-fElapsedTime);
|
||||
if(hurtRumbleTime>0.f){
|
||||
hurtRumbleTime=std::max(0.f,hurtRumbleTime-fElapsedTime);
|
||||
if(hurtRumbleTime==0.f){
|
||||
@ -755,6 +756,12 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
|
||||
}
|
||||
lastHitTimer=0.05f;
|
||||
|
||||
if(!lowHealthSoundPlayed&&lowHealthSoundPlayedTimer==0.f&&GetHealth()/GetMaxHealth()<="Player.Health Warning Pct"_F/100.f){
|
||||
SoundEffect::PlaySFX("Health Warning",SoundEffect::CENTERED);
|
||||
lowHealthSoundPlayed=true;
|
||||
lowHealthSoundPlayedTimer="Player.Health Warning Cooldown"_F;
|
||||
}
|
||||
|
||||
if(game->GetPlayer()->GetHealth()<game->GetPlayer()->GetMaxHealth()*0.5f&&!Tutorial::TaskIsComplete(TutorialTaskName::USE_RECOVERY_ITEMS)){
|
||||
Tutorial::SetNextTask(TutorialTaskName::USE_RECOVERY_ITEMS);
|
||||
}
|
||||
@ -1269,6 +1276,10 @@ void Player::PerformHPRecovery(){
|
||||
if(GetHealth()<GetMaxHealth()){
|
||||
Heal(hpRecoveryAmt);
|
||||
}
|
||||
|
||||
if(GetHealth()/GetMaxHealth()>"Player.Health Warning Pct"_F/100.f){
|
||||
lowHealthSoundPlayed=false;
|
||||
}
|
||||
}
|
||||
|
||||
const float Player::GetDamageReductionPct()const{
|
||||
|
@ -313,6 +313,8 @@ private:
|
||||
//Typical usage is playerInvoked is true on first call, and playerInvoked is false on all subsequent chained calls.
|
||||
bool _SetY(float y,const bool playerInvoked=true);
|
||||
const bool UsingAutoAim()const;
|
||||
bool lowHealthSoundPlayed=false;
|
||||
float lowHealthSoundPlayedTimer=0.f;
|
||||
protected:
|
||||
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
|
||||
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;
|
||||
|
@ -9,7 +9,3 @@ do we need a minimap? (maybe with fog of war?) Maybe polling that once testing w
|
||||
should gemstones dropp from boss stages aswell? (Maybe lower droprate?)
|
||||
|
||||
Toggle for displaying error messages
|
||||
|
||||
Low health warning
|
||||
|
||||
I think thats your easiest bet, option to display as is, full numbers (which may/will get super small), and scientific notation as a middle ground if the full one does get crazy. That should please most people looking for information on those stats
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 5
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 8142
|
||||
#define VERSION_BUILD 8145
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -44,6 +44,17 @@ Player
|
||||
# How long the rumble lasts when getting hit by a monster.
|
||||
Hurt Rumble Time = 0.1s
|
||||
|
||||
# Warning sound percentage threshold
|
||||
Health Warning Pct = 30%
|
||||
|
||||
# Warning sound cooldown
|
||||
Health Warning Cooldown = 8.0s
|
||||
|
||||
# Health Warning Flicker On/Off
|
||||
Health Warning Flicker Time = 0.5s
|
||||
|
||||
Health Warning Outline Color = 255,0,0,255
|
||||
|
||||
# Each attack will have _N,_E,_S,_W appended to them once read in-game.
|
||||
PLAYER_ANIMATION[0] = WARRIOR_WALK
|
||||
PLAYER_ANIMATION[1] = WARRIOR_IDLE
|
||||
|
@ -69,6 +69,11 @@ Events
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
File[0] = footsteps_wet.ogg, 100%
|
||||
}
|
||||
Health Warning
|
||||
{
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
File[0] = health_warning.ogg, 80%
|
||||
}
|
||||
Buy Item
|
||||
{
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
|
@ -20,6 +20,7 @@ Images
|
||||
GFX_FireRing3 = fire_ring3.png
|
||||
GFX_FireRing4 = fire_ring4.png
|
||||
GFX_Heart = heart.png
|
||||
GFX_Heart_Outline = heart_outline.png
|
||||
GFX_Laser = laser.png
|
||||
GFX_LightningBolt = lightning_bolt.png
|
||||
GFX_LightningBoltParticle1 = lightning_bolt_part1.png
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 4.2 KiB |
BIN
Adventures in Lestoria/assets/heart_outline.png
Normal file
BIN
Adventures in Lestoria/assets/heart_outline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 654 B |
BIN
Adventures in Lestoria/assets/sounds/health_warning.ogg
Normal file
BIN
Adventures in Lestoria/assets/sounds/health_warning.ogg
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user