Mario: check before bouncing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user