game/mario/visitors/bounce_visitor.hpp

35 lines
730 B
C++
Raw Normal View History

#ifndef BOUNCE_VISITOR_HPP
#define BOUNCE_VISITOR_HPP
#include "../../sdlpp/sdlpp_visitor.hpp"
#include "../../sdlpp/sdlpp_geometry.hpp"
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