Skip to content
Snippets Groups Projects
Commit 59b27416 authored by Claudio Hoffmann's avatar Claudio Hoffmann
Browse files

Merge lives display from branch 'weber'

parents b0689498 74b8d06d
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,6 @@ int difficulty = 0;
int screenWidth = 320;
int screenHeigth = 320;
// global helper funktion to add "buildings"
void addBuilding(float x, float y, int size, Level &level_ptr)
{
......@@ -263,7 +262,9 @@ public:
framebuffer.blit_topleft(i.ScorePos,i.getScoreSprite());
}
}
framebuffer.blit_topleft({ 3, 3 },player_.getLivesSprite());
// kruegerzo72182>
// <hoffmanncl72341
platform.render(framebuffer);
++frame;
......
......@@ -218,3 +218,64 @@ void Player::shoot(Level &level)
}
}
static StaticPixelBuffer<39,7> constexpr lives[6]={
{{{
{" "},
{" "},
{" "},
{" "},
{" "},
{" "},
{" "}
}}},
{{{
{" 22 22 "},
{"2222222 "},
{"2222222 "},
{"2222222 "},
{" 22222 "},
{" 222 "},
{" 2 "}
}}},
{{{
{" 22 22 22 22 "},
{"2222222 2222222 "},
{"2222222 2222222 "},
{"2222222 2222222 "},
{" 22222 22222 "},
{" 222 222 "},
{" 2 2 "}
}}},
{{{
{" 22 22 22 22 22 22 "},
{"2222222 2222222 2222222 "},
{"2222222 2222222 2222222 "},
{"2222222 2222222 2222222 "},
{" 22222 22222 22222 "},
{" 222 222 222 "},
{" 2 2 2 "}
}}},
{{{
{" 22 22 22 22 22 22 22 22 "},
{"2222222 2222222 2222222 2222222 "},
{"2222222 2222222 2222222 2222222 "},
{"2222222 2222222 2222222 2222222 "},
{" 22222 22222 22222 22222 "},
{" 222 222 222 222 "},
{" 2 2 2 2 "}
}}},
{{{
{" 22 22 22 22 22 22 22 22 22 22 "},
{"2222222 2222222 2222222 2222222 2222222"},
{"2222222 2222222 2222222 2222222 2222222"},
{"2222222 2222222 2222222 2222222 2222222"},
{" 22222 22222 22222 22222 22222 "},
{" 222 222 222 222 222 "},
{" 2 2 2 2 2 "}
}}}
};
const PixelBuffer& Player::getLivesSprite()
{
return lives[hitpoints];
}
......@@ -22,6 +22,7 @@ public:
PixelBuffer const& getSprite() override;
void move(Platform &p, FloatSeconds const & Frametime, Level &level);
void shoot(Level &level);
const PixelBuffer& getLivesSprite();
};
#endif // PLAYER_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment