Mario: end of level logic

This commit is contained in:
2022-09-23 16:46:50 +02:00
parent 6211e8c756
commit 3437aa6b47
8 changed files with 88 additions and 23 deletions
+6
View File
@@ -67,6 +67,12 @@ void MarioVisitor::visit(const SDLPP::RenderObject &obj) {
case MUSHROOM_ID:
mushroom = true;
break;
case POLE_BOTTOM_ID:
case POLE_TOP_ID:
case FLAG_ID:
_end = true;
endPos = obj.getPos();
break;
default:
break;
}
+10
View File
@@ -108,6 +108,14 @@ public:
return _bounce;
}
bool levelEnd() {
return _end;
}
const SDLPP::Vec2D<double> &getEndPos() {
return endPos;
}
private:
bool onGround = false;
double groundY = 0;
@@ -130,6 +138,8 @@ private:
bool mushroom = false;
std::vector<std::shared_ptr<MarioBlock>> &_moving_objects;
bool _bounce = false;
bool _end = false;
SDLPP::Vec2D<double> endPos;
};
#endif