2021-08-08 19:45:05 +00:00
|
|
|
#ifndef GOOMBA_VISITOR_H
|
|
|
|
#define GOOMBA_VISITOR_H
|
|
|
|
|
|
|
|
#include "../../sdlpp/sdlpp_visitor.hpp"
|
|
|
|
#include "../../sdlpp/sdlpp_geometry.hpp"
|
|
|
|
#include "../../sdlpp/sdlpp_scene.hpp"
|
|
|
|
#include "../blocks.hpp"
|
|
|
|
|
|
|
|
class GoombaVisitor : public SDLPP::Visitor {
|
|
|
|
public:
|
2022-09-25 17:44:28 +00:00
|
|
|
GoombaVisitor() = delete;
|
|
|
|
GoombaVisitor(const SDLPP::Vec2D<double> &pos) : goomba_pos(pos) {}
|
2021-10-18 08:10:43 +00:00
|
|
|
void visit(const SDLPP::RenderObject &obj) override;
|
2021-08-08 19:45:05 +00:00
|
|
|
bool isOnGround() const {
|
|
|
|
return onGround;
|
|
|
|
}
|
|
|
|
bool isDead() const {
|
|
|
|
return death;
|
|
|
|
}
|
2021-10-18 08:10:43 +00:00
|
|
|
void setFromId(uint64_t id) override {
|
2021-08-08 19:45:05 +00:00
|
|
|
from = id;
|
|
|
|
}
|
2021-10-18 08:10:43 +00:00
|
|
|
void setVisitorType(uint64_t type) override {
|
2021-08-08 19:45:05 +00:00
|
|
|
_type = type;
|
|
|
|
}
|
|
|
|
uint64_t getVisitorType() const override {
|
|
|
|
return _type;
|
|
|
|
}
|
|
|
|
uint64_t getFromId() const override {
|
|
|
|
return from;
|
|
|
|
}
|
|
|
|
bool canGoLeft() const {
|
|
|
|
return !left;
|
|
|
|
}
|
|
|
|
bool canGoRight() const {
|
|
|
|
return !right;
|
|
|
|
}
|
|
|
|
double getGroundY() const {
|
|
|
|
return groundY;
|
|
|
|
}
|
|
|
|
bool topBlock() const {
|
|
|
|
return top_hit;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SDLPP::Vec2D<double> &getMovementBlockage() {
|
|
|
|
return movement_blockage;
|
|
|
|
}
|
|
|
|
double getValidXPos() const {
|
|
|
|
return validXPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool onGround = false;
|
|
|
|
double groundY = 0;
|
|
|
|
uint64_t _type{};
|
|
|
|
bool death = false;
|
|
|
|
uint64_t from = -1;
|
|
|
|
bool left = false;
|
|
|
|
bool right = false;
|
|
|
|
bool top_hit = false;
|
|
|
|
SDLPP::Vec2D<double> movement_blockage;
|
|
|
|
double validXPos = 0;
|
2022-09-25 17:44:28 +00:00
|
|
|
const SDLPP::Vec2D<double> goomba_pos;
|
2021-08-08 19:45:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|