Mario: prepartations for multiple moving objects

This commit is contained in:
2021-08-05 00:32:17 +02:00
parent 37f7bab63e
commit bfe658618e
19 changed files with 321 additions and 249 deletions
+34
View File
@@ -0,0 +1,34 @@
#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