Refactor to use objects for terrain/mod creation, added coin modifier

This commit is contained in:
2021-07-23 00:08:05 +02:00
parent 79d9f266b4
commit 3be728843a
15 changed files with 1384 additions and 127 deletions
+6 -1
View File
@@ -4,9 +4,12 @@
#include "../sdlpp/sdlpp_rectrenderer.hpp"
#include "mario_visitor.hpp"
#include "sprites.hpp"
#include "blocks.hpp"
class Mario : public SDLPP::RectangleRender {
// TODO change to MarioBlock instead of RectangleRender
class Mario : public MarioBlock {
public:
Mario(int x, int y, const std::shared_ptr< SDLPP::Renderer > &renderer);
Mario(const std::shared_ptr< SDLPP::Renderer > &renderer);
void walkLeft();
void walkRight();
@@ -15,6 +18,7 @@ public:
void jump();
void stopJump();
virtual void custom_move( int ticks ) override;
void visit(SDLPP::Visitor &visitor) override;
private:
bool faces_right = true;
double side_movement = 0.39;
@@ -31,6 +35,7 @@ private:
const double gravity_add_jumping = jump_movement/32.0;
const double gravity_add_falling = jump_movement/(64.0/7.0);
std::shared_ptr<SDLPP::RectColider> top_collision = nullptr;
virtual void setWorldTypeSrc(LandType::Value world) override;
};
#endif