Mario: check before bouncing

This commit is contained in:
2021-05-26 18:24:09 +02:00
parent 734b0b58cb
commit 6e61eb03b9
6 changed files with 56 additions and 2 deletions
+27
View File
@@ -80,4 +80,31 @@ private:
SDLPP::Vec2D<double> movement_blockage;
};
class BounceVisitor : public SDLPP::Visitor {
public:
BounceVisitor() {}
virtual void visit( const SDLPP::RenderObject &obj ) override;
virtual void setFromId( uint64_t id ) override {
from = id;
}
virtual uint64_t getFromId() override {
return from;
}
virtual void setVisitorType( uint64_t type ) override {
_type = type;
}
virtual uint64_t getVisitorType() override {
return _type;
}
bool canBounce() {
return hits <= 2;
}
private:
int hits = 0;
uint64_t from;
uint64_t _type;
};
#endif