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:
+14
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user