Differentiate between player damage indicators and enemy damage indicators.
This commit is contained in:
parent
13dece2844
commit
b80d791578
@ -973,7 +973,11 @@ void Crawler::RenderWorld(float fElapsedTime){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string text=std::to_string(dn->damage);
|
std::string text=std::to_string(dn->damage);
|
||||||
view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,DARK_RED);
|
if(!dn->friendly){
|
||||||
|
view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,DARK_RED);
|
||||||
|
}else{
|
||||||
|
view.DrawShadowStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,RED,VERY_DARK_GREY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG_PATHFINDING){
|
if(DEBUG_PATHFINDING){
|
||||||
|
@ -6,6 +6,6 @@ DamageNumber::DamageNumber()
|
|||||||
:damage(0){
|
:damage(0){
|
||||||
}
|
}
|
||||||
|
|
||||||
DamageNumber::DamageNumber(vf2d pos,int damage):
|
DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly):
|
||||||
pos(pos),damage(damage){
|
pos(pos),damage(damage),friendly(friendly){
|
||||||
}
|
}
|
@ -6,7 +6,8 @@ struct DamageNumber{
|
|||||||
int damage;
|
int damage;
|
||||||
float lifeTime=0;
|
float lifeTime=0;
|
||||||
float pauseTime=0;
|
float pauseTime=0;
|
||||||
|
bool friendly=false;
|
||||||
const static float MOVE_UP_TIME;
|
const static float MOVE_UP_TIME;
|
||||||
DamageNumber();
|
DamageNumber();
|
||||||
DamageNumber(vf2d pos,int damage);
|
DamageNumber(vf2d pos,int damage,bool friendly=false);
|
||||||
};
|
};
|
@ -252,9 +252,8 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){
|
|||||||
damageNumberPtr.get()->damage+=int(mod_dmg);
|
damageNumberPtr.get()->damage+=int(mod_dmg);
|
||||||
damageNumberPtr.get()->pauseTime=0.4;
|
damageNumberPtr.get()->pauseTime=0.4;
|
||||||
} else {
|
} else {
|
||||||
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(pos,int(mod_dmg)));
|
damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg));
|
||||||
std::shared_ptr<DamageNumber>numb=*(DAMAGENUMBER_LIST.end()-1);
|
DAMAGENUMBER_LIST.push_back(damageNumberPtr);
|
||||||
damageNumberPtr=numb;
|
|
||||||
}
|
}
|
||||||
lastHitTimer=0.05;
|
lastHitTimer=0.05;
|
||||||
if(!IsAlive()){
|
if(!IsAlive()){
|
||||||
|
@ -516,9 +516,8 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
|
|||||||
damageNumberPtr.get()->damage+=int(mod_dmg);
|
damageNumberPtr.get()->damage+=int(mod_dmg);
|
||||||
damageNumberPtr.get()->pauseTime=0.4;
|
damageNumberPtr.get()->pauseTime=0.4;
|
||||||
} else {
|
} else {
|
||||||
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(pos,int(mod_dmg)));
|
damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg),true);
|
||||||
std::shared_ptr<DamageNumber>numb=*(DAMAGENUMBER_LIST.end()-1);
|
DAMAGENUMBER_LIST.push_back(damageNumberPtr);
|
||||||
damageNumberPtr=numb;
|
|
||||||
}
|
}
|
||||||
lastHitTimer=0.05;
|
lastHitTimer=0.05;
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 1504
|
#define VERSION_BUILD 1509
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -182,6 +182,8 @@ namespace olc
|
|||||||
// Draws a multiline string as a decal, with tiniting and scaling
|
// Draws a multiline string as a decal, with tiniting and scaling
|
||||||
void DrawStringDecal(const olc::vf2d& pos, const std::string& sText, const olc::Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f });
|
void DrawStringDecal(const olc::vf2d& pos, const std::string& sText, const olc::Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f });
|
||||||
void DrawStringPropDecal(const olc::vf2d& pos, const std::string& sText, const olc::Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f });
|
void DrawStringPropDecal(const olc::vf2d& pos, const std::string& sText, const olc::Pixel col = olc::WHITE, const olc::vf2d& scale = { 1.0f, 1.0f });
|
||||||
|
void DrawShadowStringDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col = olc::WHITE, const Pixel shadowCol = olc::BLACK, const olc::vf2d& scale = { 1.0f, 1.0f },const float shadowSizeFactor=1);
|
||||||
|
void DrawShadowStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col = olc::WHITE, const Pixel shadowCol = olc::BLACK, const olc::vf2d& scale = { 1.0f, 1.0f },const float shadowSizeFactor=1);
|
||||||
// Draws a single shaded filled rectangle as a decal
|
// Draws a single shaded filled rectangle as a decal
|
||||||
void FillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE);
|
void FillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE);
|
||||||
void DrawRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE);
|
void DrawRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel col = olc::WHITE);
|
||||||
@ -634,6 +636,14 @@ namespace olc
|
|||||||
pge->DrawStringPropDecal(WorldToScreen(pos), sText, col, scale * m_vWorldScale * m_vRecipPixel);
|
pge->DrawStringPropDecal(WorldToScreen(pos), sText, col, scale * m_vWorldScale * m_vRecipPixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TransformedView::DrawShadowStringDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){
|
||||||
|
pge->DrawShadowStringDecal(WorldToScreen(pos),sText,col,shadowCol,scale,shadowSizeFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransformedView::DrawShadowStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const Pixel shadowCol, const olc::vf2d& scale,const float shadowSizeFactor){
|
||||||
|
pge->DrawShadowStringPropDecal(WorldToScreen(pos),sText,col,shadowCol,scale,shadowSizeFactor);
|
||||||
|
}
|
||||||
|
|
||||||
void TransformedView::FillRectDecal(const olc::vf2d & pos, const olc::vf2d & size, const olc::Pixel col)
|
void TransformedView::FillRectDecal(const olc::vf2d & pos, const olc::vf2d & size, const olc::Pixel col)
|
||||||
{
|
{
|
||||||
pge->FillRectDecal(WorldToScreen(pos), (size * m_vWorldScale).ceil(), col);
|
pge->FillRectDecal(WorldToScreen(pos), (size * m_vWorldScale).ceil(), col);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user