Mario: add basic big mario logic

This commit is contained in:
2022-09-25 19:44:28 +02:00
parent 09cb13195c
commit 4109cfe1af
12 changed files with 156 additions and 57 deletions
+17 -5
View File
@@ -8,11 +8,13 @@
class MarioVisitor : public SDLPP::Visitor {
public:
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &death,
MarioVisitor(bool is_jumping, SDLPP::Scene &scene,
int &coin_count,
std::vector<std::shared_ptr<MarioBlock>> &moving_objects)
: jumping(is_jumping), _scene(scene), _death(death),
_coin_count(coin_count), _moving_objects(moving_objects) {}
std::vector<std::shared_ptr<MarioBlock>> &moving_objects,
bool is_big, bool has_star)
: jumping(is_jumping), _scene(scene),
_coin_count(coin_count), _moving_objects(moving_objects),
_is_big(is_big), _has_star(has_star) {}
void visit(const SDLPP::RenderObject &obj) override;
bool isOnGround() const {
return onGround;
@@ -116,6 +118,14 @@ public:
return endPos;
}
bool isBig() const {
return _is_big;
}
bool hasStar() const {
return _has_star;
}
private:
bool onGround = false;
double groundY = 0;
@@ -133,13 +143,15 @@ private:
SDLPP::Vec2D<double> movement_blockage;
std::shared_ptr<MarioBlock> coin_block = nullptr;
SDLPP::Scene &_scene;
bool &_death;
int &_coin_count;
bool mushroom = false;
std::vector<std::shared_ptr<MarioBlock>> &_moving_objects;
bool _bounce = false;
bool _end = false;
SDLPP::Vec2D<double> endPos;
bool _is_big = false;
bool _has_star = false;
bool _death = false;
};
#endif