game/mario/blocks/turtleblock.hpp

36 lines
864 B
C++

#ifndef TURTLE_BLOCK_HPP
#define TURTLE_BLOCK_HPP
#include "../blocks.hpp"
class TurtleBlock : public MarioBlock {
public:
TurtleBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
void custom_move(int ticks) override;
void move(int ticks) override;
void handleVisitor(SDLPP::Visitor &visitor) override;
bool isShell() const {
return is_shell;
}
void setShell(bool shell = true) {
is_shell = shell;
}
double getMovementAfterSwitch() const {
if(switched_after_turtle) {
return -getMovement().getX();
} else {
return getMovement().getX();
}
}
private:
void startDeath();
int death_countdown = 100;
bool death_started = false;
bool is_shell = false;
double next_movement = 0;
bool switched_after_turtle = false;
};
#endif