game/mario/visitors/goomba_visitor.hpp
zv0n 7bd652f4e9
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Mario: Fireball works
2022-11-12 21:32:18 +01:00

71 lines
1.6 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;
}
bool instantDeath() const {
return instant_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;
bool instant_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