Differentiate between player damage indicators and enemy damage indicators.

pull/28/head
sigonasr2 1 year ago
parent 13dece2844
commit b80d791578
  1. 6
      Crawler/Crawler.cpp
  2. 4
      Crawler/DamageNumber.cpp
  3. 3
      Crawler/DamageNumber.h
  4. 5
      Crawler/Monster.cpp
  5. 5
      Crawler/Player.cpp
  6. 2
      Crawler/Version.h
  7. 10
      Crawler/olcPGEX_TransformedView.h

@ -973,7 +973,11 @@ void Crawler::RenderWorld(float fElapsedTime){
}
}
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){

@ -6,6 +6,6 @@ DamageNumber::DamageNumber()
:damage(0){
}
DamageNumber::DamageNumber(vf2d pos,int damage):
pos(pos),damage(damage){
DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly):
pos(pos),damage(damage),friendly(friendly){
}

@ -6,7 +6,8 @@ struct DamageNumber{
int damage;
float lifeTime=0;
float pauseTime=0;
bool friendly=false;
const static float MOVE_UP_TIME;
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()->pauseTime=0.4;
} else {
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(pos,int(mod_dmg)));
std::shared_ptr<DamageNumber>numb=*(DAMAGENUMBER_LIST.end()-1);
damageNumberPtr=numb;
damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg));
DAMAGENUMBER_LIST.push_back(damageNumberPtr);
}
lastHitTimer=0.05;
if(!IsAlive()){

@ -516,9 +516,8 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
damageNumberPtr.get()->damage+=int(mod_dmg);
damageNumberPtr.get()->pauseTime=0.4;
} else {
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(pos,int(mod_dmg)));
std::shared_ptr<DamageNumber>numb=*(DAMAGENUMBER_LIST.end()-1);
damageNumberPtr=numb;
damageNumberPtr=std::make_shared<DamageNumber>(pos,int(mod_dmg),true);
DAMAGENUMBER_LIST.push_back(damageNumberPtr);
}
lastHitTimer=0.05;
return true;

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 1504
#define VERSION_BUILD 1509
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -182,6 +182,8 @@ namespace olc
// 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 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
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);
@ -634,6 +636,14 @@ namespace olc
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)
{
pge->FillRectDecal(WorldToScreen(pos), (size * m_vWorldScale).ceil(), col);

Loading…
Cancel
Save