diff --git a/main.cpp b/main.cpp index 07634e1a4e36580f9360e9c6de41db7b31bb61b5..db2aa15843bd16692d374293cd52e48850292d39 100644 --- a/main.cpp +++ b/main.cpp @@ -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; diff --git a/player.cpp b/player.cpp index 700dbbd316d7d2f91e86440ae114441dd38bc48b..cf393d37deaecf9f3b70e1e61d2390c41487a849 100644 --- a/player.cpp +++ b/player.cpp @@ -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]; +} diff --git a/player.hpp b/player.hpp index c37d0df83481e43c7aab0b8244b0cd6c05490081..f90864faa9ab0aeda10b9604f4eb7120bc34d802 100644 --- a/player.hpp +++ b/player.hpp @@ -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