game/mario/visitors/mushroom_visitor.hpp

57 lines
1.3 KiB
C++
Raw Normal View History

2021-08-07 19:41:15 +00:00
#ifndef MUSHROOM_VISITOR_H
#define MUSHROOM_VISITOR_H
#include "../../sdlpp/sdlpp_visitor.hpp"
#include "../../sdlpp/sdlpp_geometry.hpp"
#include "../../sdlpp/sdlpp_scene.hpp"
#include "../blocks.hpp"
class MushroomVisitor : public SDLPP::Visitor {
public:
MushroomVisitor() = default;
void visit( const SDLPP::RenderObject &obj ) override;
bool isOnGround() const {
return onGround;
}
void setFromId( uint64_t id ) override {
from = id;
}
uint64_t getFromId() const override {
return from;
}
void setVisitorType( uint64_t type ) override {
_type = type;
}
uint64_t getVisitorType() const override {
return _type;
}
bool canGoLeft() const {
return !left;
}
bool canGoRight() const {
return !right;
}
double getGroundY() const {
return groundY;
}
const SDLPP::Vec2D<double> &getMovementBlockage() {
return movement_blockage;
}
bool getDeath() {
return death;
}
private:
bool onGround = false;
double groundY = 0;
bool stop = false;
bool left = false;
bool right = false;
SDLPP::Vec2D<double> movement_blockage;
uint64_t from{};
uint64_t _type{};
bool death = false;
};
#endif