Mario: destroy blocks 1 at a time, if jumping and would hit only with small side, move Mario a bit so the jump is successful

This commit is contained in:
2021-05-25 12:26:04 +02:00
parent 7390f684f5
commit 7ed8b0f4e1
6 changed files with 40 additions and 21 deletions
+14 -1
View File
@@ -6,7 +6,7 @@
class MarioVisitor : public SDLPP::Visitor {
public:
MarioVisitor() {}
MarioVisitor(bool is_jumping) : jumping(is_jumping) {}
virtual void visit( const SDLPP::RenderObject &obj ) override;
bool isOnGround() {
return onGround;
@@ -44,6 +44,16 @@ public:
bool topBlock() {
return top_hit;
}
bool moveTop() {
return top_left_right;
}
const SDLPP::Vec2D<double> &getRightLeftPos() {
return rightleftpos;
}
bool canDestroy() {
return jumping && !top_hit;
}
private:
bool onGround = false;
@@ -56,6 +66,9 @@ private:
bool right = false;
uint64_t _type = 0;
bool top_hit = false;
SDLPP::Vec2D<double> rightleftpos;
bool top_left_right = false;
bool jumping;
};
#endif