Mario: fix modifier deletion

This commit is contained in:
2021-08-07 12:13:23 +02:00
parent 7b1ef25f37
commit 6238022ed2
8 changed files with 88 additions and 77 deletions
+18 -18
View File
@@ -9,51 +9,51 @@
class MarioVisitor : public SDLPP::Visitor {
public:
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &quit, int &coin_count) : jumping(is_jumping), _scene(scene), _quit(quit), _coin_count(coin_count) {}
virtual void visit( const SDLPP::RenderObject &obj ) override;
bool isOnGround() {
void visit( const SDLPP::RenderObject &obj ) override;
bool isOnGround() const {
return onGround;
}
bool isDead() {
bool isDead() const {
return death;
}
bool isStopped() {
bool isStopped() const {
return stop;
}
double newXPos() {
double newXPos() const {
return newX;
}
virtual void setFromId( uint64_t id ) override {
void setFromId( uint64_t id ) override {
from = id;
}
virtual uint64_t getFromId() override {
uint64_t getFromId() const override {
return from;
}
virtual void setVisitorType( uint64_t type ) override {
void setVisitorType( uint64_t type ) override {
_type = type;
}
virtual uint64_t getVisitorType() override {
uint64_t getVisitorType() const override {
return _type;
}
bool canGoLeft() {
bool canGoLeft() const {
return !left;
}
bool canGoRight() {
bool canGoRight() const {
return !right;
}
double getGroundY() {
double getGroundY() const {
return groundY;
}
bool topBlock() {
bool topBlock() const {
return top_hit;
}
bool moveTop() {
bool moveTop() const {
return top_left_right && !top_hit;
}
const SDLPP::Vec2D<double> &getRightLeftPos() {
return rightleftpos;
}
bool canDestroy() {
bool canDestroy() const {
return jumping && !top_hit;
}
@@ -61,7 +61,7 @@ public:
return movement_blockage;
}
double getStopX() {
double getStopX() const {
return newX;
}
@@ -71,7 +71,7 @@ public:
_coin_count++;
}
bool hasCoin() {
bool hasCoin() const {
return coin;
}
@@ -95,7 +95,7 @@ private:
double groundY = 0;
bool death = false;
bool stop = false;
double newX;
double newX{};
uint64_t from = -1;
bool left = false;
bool right = false;