game/mario/visitors/goomba_visitor.hpp
zv0n 4109cfe1af
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Mario: add basic big mario logic
2022-09-25 19:44:28 +02:00

67 lines
1.5 KiB
C++

#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:
GoombaVisitor() = delete;
GoombaVisitor(const SDLPP::Vec2D<double> &pos) : goomba_pos(pos) {}
void visit(const SDLPP::RenderObject &obj) override;
bool isOnGround() const {
return onGround;
}
bool isDead() const {
return death;
}
void setFromId(uint64_t id) override {
from = id;
}
void setVisitorType(uint64_t type) override {
_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;
const SDLPP::Vec2D<double> goomba_pos;
};
#endif