game/mario/visitors/mushroom_visitor.hpp

61 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;
2021-10-18 08:10:43 +00:00
void visit(const SDLPP::RenderObject &obj) override;
2021-08-07 19:41:15 +00:00
bool isOnGround() const {
return onGround;
}
2021-10-18 08:10:43 +00:00
void setFromId(uint64_t id) override {
2021-08-07 19:41:15 +00:00
from = id;
}
uint64_t getFromId() const override {
return from;
}
2021-10-18 08:10:43 +00:00
void setVisitorType(uint64_t type) override {
2021-08-07 19:41:15 +00:00
_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;
}
2021-08-07 20:17:27 +00:00
double getValidXPos() {
return validXPos;
}
2021-08-07 19:41:15 +00:00
private:
bool onGround = false;
double groundY = 0;
2021-08-07 20:17:27 +00:00
double validXPos = 0;
2021-08-07 19:41:15 +00:00
bool stop = false;
bool left = false;
bool right = false;
SDLPP::Vec2D<double> movement_blockage;
uint64_t from{};
uint64_t _type{};
bool death = false;
};
#endif