game/mario/visitors/projectile_visitor.hpp

61 lines
1.3 KiB
C++
Raw Normal View History

2022-11-12 20:32:18 +00:00
#ifndef PROJECTILE_VISITOR_H
#define PROJECTILE_VISITOR_H
#include "../../sdlpp/sdlpp_visitor.hpp"
#include "../../sdlpp/sdlpp_geometry.hpp"
#include "../../sdlpp/sdlpp_scene.hpp"
#include "../blocks.hpp"
class ProjectileVisitor : public SDLPP::Visitor {
public:
ProjectileVisitor() = 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;
}
double getValidXPos() {
return validXPos;
}
private:
bool onGround = false;
double groundY = 0;
double validXPos = 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