Added health indicator
This commit is contained in:
parent
a94528fe3e
commit
9db2565060
@ -34,6 +34,7 @@ bool Crawler::OnUserCreate(){
|
||||
GFX_Circle.Load("assets/circle.png");
|
||||
GFX_Effect_GroundSlam_Back.Load("assets/ground-slam-attack-back.png");
|
||||
GFX_Effect_GroundSlam_Front.Load("assets/ground-slam-attack-front.png");
|
||||
GFX_Heart.Load("assets/heart.png");
|
||||
|
||||
//Animations
|
||||
InitializeAnimations();
|
||||
@ -441,6 +442,16 @@ void Crawler::RenderHud(){
|
||||
DrawRotatedStringPropDecal(vf2d{8,ScreenHeight()-20.f}+vf2d{1,1},"G R O U N D S L A M",-PI/64,{0,0},BLACK,{0.4,0.4});
|
||||
DrawRotatedStringPropDecal({8,ScreenHeight()-20.f},"G R O U N D S L A M",-PI/64,{0,0},WHITE,{0.4,0.4});
|
||||
}
|
||||
DrawDecal({2,2},GFX_Heart.Decal());
|
||||
std::string text=player.GetHealth()>0?std::to_string(player.GetHealth()):"X";
|
||||
for(int y=-1;y<=1;y++){
|
||||
for(int x=-1;x<=1;x++){
|
||||
if(x!=0||y!=0){
|
||||
DrawStringPropDecal(vf2d{20,3}+vf2d{float(x),float(y)},text,BLACK,{2,2});
|
||||
}
|
||||
}
|
||||
}
|
||||
DrawStringPropDecal({20,3},text,WHITE,{2,2});
|
||||
}
|
||||
|
||||
void Crawler::AddEffect(Effect foreground,Effect background){
|
||||
|
@ -13,7 +13,8 @@ class Crawler : public olc::PixelGameEngine
|
||||
Camera2D camera;
|
||||
Player player;
|
||||
Renderable GFX_Pl_Sheet,GFX_Slime_Sheet,GFX_Circle,
|
||||
GFX_Effect_GroundSlam_Back,GFX_Effect_GroundSlam_Front;
|
||||
GFX_Effect_GroundSlam_Back,GFX_Effect_GroundSlam_Front,
|
||||
GFX_Heart;
|
||||
std::vector<Effect>foregroundEffects,backgroundEffects;
|
||||
|
||||
public:
|
||||
|
@ -15,7 +15,7 @@ private:
|
||||
float moveSpd=1.0f;
|
||||
float size=1.0f;
|
||||
float attack_range=1.5f;
|
||||
const float ATTACK_COOLDOWN=0.75f;
|
||||
const float ATTACK_COOLDOWN=0.35f;
|
||||
float attack_cooldown_timer=0;
|
||||
float spin_attack_timer=0;
|
||||
float spin_spd=0;
|
||||
|
BIN
Crawler/assets/heart.png
Normal file
BIN
Crawler/assets/heart.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 689 B |
Loading…
x
Reference in New Issue
Block a user