Mario: Add restart and background color for menus

This commit is contained in:
2022-09-22 20:16:46 +02:00
parent 8b9ef16929
commit a1afaf427a
10 changed files with 95 additions and 41 deletions
+4 -5
View File
@@ -8,17 +8,17 @@
class MarioVisitor : public SDLPP::Visitor {
public:
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &quit,
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &death,
int &coin_count,
std::vector<std::shared_ptr<MarioBlock>> &moving_objects)
: jumping(is_jumping), _scene(scene), _quit(quit),
: jumping(is_jumping), _scene(scene), _death(death),
_coin_count(coin_count), _moving_objects(moving_objects) {}
void visit(const SDLPP::RenderObject &obj) override;
bool isOnGround() const {
return onGround;
}
bool isDead() const {
return death;
return _death;
}
bool isStopped() const {
return stop;
@@ -111,7 +111,6 @@ public:
private:
bool onGround = false;
double groundY = 0;
bool death = false;
bool stop = false;
double newX{};
uint64_t from = -1;
@@ -126,7 +125,7 @@ private:
SDLPP::Vec2D<double> movement_blockage;
std::shared_ptr<MarioBlock> coin_block = nullptr;
SDLPP::Scene &_scene;
bool &_quit;
bool &_death;
int &_coin_count;
bool mushroom = false;
std::vector<std::shared_ptr<MarioBlock>> &_moving_objects;