Add coin animation

This commit is contained in:
2021-07-24 20:50:24 +02:00
parent 130a01feda
commit e67cf508a2
12 changed files with 89 additions and 14 deletions
+14
View File
@@ -3,6 +3,7 @@
#include "../sdlpp/sdlpp_visitor.hpp"
#include "../sdlpp/sdlpp_geometry.hpp"
#include "blocks.hpp"
class MarioVisitor : public SDLPP::Visitor {
public:
@@ -71,6 +72,18 @@ public:
return coin;
}
void setCoinBlock(std::shared_ptr<MarioBlock> &coin) {
coin_block = coin;
}
bool hasCoinBlock() {
return coin_block != nullptr;
}
std::shared_ptr<MarioBlock> &getCoinBlock() {
return coin_block;
}
private:
bool onGround = false;
double groundY = 0;
@@ -87,6 +100,7 @@ private:
bool jumping;
bool coin = false;
SDLPP::Vec2D<double> movement_blockage;
std::shared_ptr<MarioBlock> coin_block = nullptr;
};
class BounceVisitor : public SDLPP::Visitor {