Mario: formatting
This commit is contained in:
parent
303490a619
commit
0d855ed218
@ -2,7 +2,8 @@
|
||||
#include "../sprites.hpp"
|
||||
#include "../global_vars.hpp"
|
||||
|
||||
CoinBlock::CoinBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, COIN_SRC, true, true) {
|
||||
CoinBlock::CoinBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, COIN_SRC, true, true) {
|
||||
setHidden(true);
|
||||
bounce_speed = 0.75;
|
||||
bounce_ticks = 150;
|
||||
|
@ -8,6 +8,7 @@ public:
|
||||
CoinBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
void custom_move(int ticks) override;
|
||||
void setParent(MarioBlock *parent);
|
||||
|
||||
private:
|
||||
MarioBlock *_parent = nullptr;
|
||||
};
|
||||
|
@ -8,8 +8,7 @@
|
||||
|
||||
class CoinEditorBlock : public MarioBlock {
|
||||
public:
|
||||
CoinEditorBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > renderer );
|
||||
CoinEditorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> renderer);
|
||||
void render() override;
|
||||
void updateSizeAndPosition() override;
|
||||
void addOne();
|
||||
|
@ -4,7 +4,10 @@
|
||||
#include "../objectids.hpp"
|
||||
#include "../visitors/goomba_visitor.hpp"
|
||||
|
||||
GoombaBlock::GoombaBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_enemies_texture, GOOMBA_WALK_ANIM[0], true, true) {
|
||||
GoombaBlock::GoombaBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_enemies_texture, GOOMBA_WALK_ANIM[0],
|
||||
true, true) {
|
||||
#ifndef EDITOR
|
||||
setAnimationFrames(GOOMBA_WALK_ANIM);
|
||||
setAnimationSpeed(12.5);
|
||||
@ -14,11 +17,11 @@ GoombaBlock::GoombaBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &rend
|
||||
auto bottom_detect = SDLPP::RectColider(0.2, 1, 0.6, 0, NPC_FLOOR_DETECT);
|
||||
bottom_detect.setMinHeight(1);
|
||||
addCollision(bottom_detect);
|
||||
addCollision(
|
||||
SDLPP::RectColider( 0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT ) );
|
||||
addCollision(SDLPP::RectColider(0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT));
|
||||
addCollision(
|
||||
SDLPP::RectColider(0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT));
|
||||
addCollision( std::make_shared<SDLPP::RectColider>( 0.5, 0, 0.2, 0.15, NPC_TOP_DETECT ) );
|
||||
addCollision(std::make_shared<SDLPP::RectColider>(0.5, 0, 0.2, 0.15,
|
||||
NPC_TOP_DETECT));
|
||||
#ifndef EDITOR
|
||||
setMovement(-0.19, 0);
|
||||
#endif
|
||||
|
@ -9,6 +9,7 @@ public:
|
||||
void custom_move(int ticks) override;
|
||||
void move(int ticks) override;
|
||||
void handleVisitor(SDLPP::Visitor &visitor) override;
|
||||
|
||||
private:
|
||||
void startDeath();
|
||||
int death_countdown = 100;
|
||||
|
@ -4,7 +4,10 @@
|
||||
#include "../objectids.hpp"
|
||||
#include "../visitors/mushroom_visitor.hpp"
|
||||
|
||||
MushroomBlock::MushroomBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, MUSHROOM_SRC, true, true) {
|
||||
MushroomBlock::MushroomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, MUSHROOM_SRC, true,
|
||||
true) {
|
||||
setHidden(true);
|
||||
ensureCollision();
|
||||
setId(MUSHROOM_ID);
|
||||
@ -13,8 +16,7 @@ MushroomBlock::MushroomBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &
|
||||
bottom_detect.setOutlineColor("#FF0000");
|
||||
bottom_detect.setMinHeight(1);
|
||||
addCollision(bottom_detect);
|
||||
addCollision(
|
||||
SDLPP::RectColider( 0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT ) );
|
||||
addCollision(SDLPP::RectColider(0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT));
|
||||
addCollision(
|
||||
SDLPP::RectColider(0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT));
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ public:
|
||||
void custom_move(int ticks) override;
|
||||
void setParent(MarioBlock *parent);
|
||||
void handleVisitor(SDLPP::Visitor &visitor) override;
|
||||
|
||||
private:
|
||||
MarioBlock *_parent = nullptr;
|
||||
bool _started_movement = false;
|
||||
|
@ -3,22 +3,21 @@
|
||||
#include "../sprites.hpp"
|
||||
#include "../objectids.hpp"
|
||||
|
||||
FloorBlock::FloorBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
FloorBlock::FloorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, FLOOR_SRC, true) {
|
||||
ensureCollision();
|
||||
setId(FLOOR_ID);
|
||||
}
|
||||
|
||||
HillInclineBlock::HillInclineBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
HillInclineBlock::HillInclineBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, HILL_INCLINE_SRC,
|
||||
false) {
|
||||
setId(HILL_INCLINE_ID);
|
||||
}
|
||||
|
||||
HillDeclineBlock::HillDeclineBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
HillDeclineBlock::HillDeclineBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, HILL_DECLINE_SRC,
|
||||
false) {
|
||||
setId(HILL_INCLINE_ID);
|
||||
@ -31,8 +30,8 @@ HillDotsRightBlock::HillDotsRightBlock(
|
||||
setId(HILL_DOTS_RIGHT_ID);
|
||||
}
|
||||
|
||||
HillDotsLeftBlock::HillDotsLeftBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
HillDotsLeftBlock::HillDotsLeftBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, HILL_DOTS_LEFT_SRC,
|
||||
false) {
|
||||
setId(HILL_DOTS_LEFT_ID);
|
||||
@ -40,8 +39,7 @@ HillDotsLeftBlock::HillDotsLeftBlock(
|
||||
|
||||
HillFillBlock::HillFillBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture, HILL_FILL_SRC,
|
||||
false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, HILL_FILL_SRC, false) {
|
||||
setId(HILL_FILL_ID);
|
||||
}
|
||||
|
||||
@ -53,8 +51,7 @@ HillTopBlock::HillTopBlock( int x, int y,
|
||||
|
||||
BushLeftBlock::BushLeftBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture, BUSH_LEFT_SRC,
|
||||
false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, BUSH_LEFT_SRC, false) {
|
||||
setId(BUSH_LEFT_ID);
|
||||
}
|
||||
|
||||
@ -67,8 +64,7 @@ BushMiddleBlock::BushMiddleBlock( int x, int y,
|
||||
|
||||
BushRightBlock::BushRightBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture, BUSH_RIGHT_SRC,
|
||||
false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, BUSH_RIGHT_SRC, false) {
|
||||
setId(BUSH_RIGHT_ID);
|
||||
}
|
||||
|
||||
@ -81,8 +77,8 @@ CloudLeftBottomBlock::CloudLeftBottomBlock(
|
||||
|
||||
CloudMiddleBottomBlock::CloudMiddleBottomBlock(
|
||||
int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture,
|
||||
CLOUD_MIDDLE_BOTTOM_SRC, false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_MIDDLE_BOTTOM_SRC,
|
||||
false) {
|
||||
setId(CLOUD_MIDDLE_BOTTOM_ID);
|
||||
}
|
||||
|
||||
@ -93,8 +89,8 @@ CloudRightBottomBlock::CloudRightBottomBlock(
|
||||
setId(CLOUD_RIGHT_BOTTOM_ID);
|
||||
}
|
||||
|
||||
CloudLeftTopBlock::CloudLeftTopBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
CloudLeftTopBlock::CloudLeftTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_LEFT_TOP_SRC,
|
||||
false) {
|
||||
setId(CLOUD_LEFT_TOP_ID);
|
||||
@ -130,16 +126,16 @@ PipeRightBottomBlock::PipeRightBottomBlock(
|
||||
setId(PIPE_RIGHT_BOTTOM_ID);
|
||||
}
|
||||
|
||||
PipeLeftTopBlock::PipeLeftTopBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
PipeLeftTopBlock::PipeLeftTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, PIPE_LEFT_TOP_SRC,
|
||||
false) {
|
||||
ensureCollision();
|
||||
setId(PIPE_LEFT_TOP_ID);
|
||||
}
|
||||
|
||||
PipeRightTopBlock::PipeRightTopBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
PipeRightTopBlock::PipeRightTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, PIPE_RIGHT_TOP_SRC,
|
||||
false) {
|
||||
ensureCollision();
|
||||
@ -153,29 +149,29 @@ CastleLeftBlock::CastleLeftBlock( int x, int y,
|
||||
setId(CASTLE_LEFT_ID);
|
||||
}
|
||||
|
||||
CastleRightBlock::CastleRightBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
CastleRightBlock::CastleRightBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_RIGHT_SRC,
|
||||
false) {
|
||||
setId(CASTLE_RIGHT_ID);
|
||||
}
|
||||
|
||||
CastleBlackBlock::CastleBlackBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
CastleBlackBlock::CastleBlackBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_BLACK_SRC,
|
||||
false) {
|
||||
setId(CASTLE_BLACK_ID);
|
||||
}
|
||||
|
||||
CastleEntryBlock::CastleEntryBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
CastleEntryBlock::CastleEntryBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_ENTRY_SRC,
|
||||
false) {
|
||||
setId(CASTLE_ENTRY_ID);
|
||||
}
|
||||
|
||||
CastleTowerBlock::CastleTowerBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
CastleTowerBlock::CastleTowerBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_TOWER_SRC,
|
||||
false) {
|
||||
setId(CASTLE_TOWER_ID);
|
||||
@ -183,8 +179,8 @@ CastleTowerBlock::CastleTowerBlock(
|
||||
|
||||
CastleTowerFilledBlock::CastleTowerFilledBlock(
|
||||
int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture,
|
||||
CASTLE_TOWER_FILLED_SRC, false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_TOWER_FILLED_SRC,
|
||||
false) {
|
||||
setId(CASTLE_TOWER_FILLED_ID);
|
||||
}
|
||||
|
||||
@ -218,21 +214,18 @@ PoleBottomBlock::PoleBottomBlock( int x, int y,
|
||||
setId(POLE_BOTTOM_ID);
|
||||
}
|
||||
|
||||
FlagBlock::FlagBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
FlagBlock::FlagBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, FLAG_SRC, false) {
|
||||
setId(FLAG_ID);
|
||||
}
|
||||
|
||||
StepBlock::StepBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
StepBlock::StepBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, STEP_SRC, true) {
|
||||
ensureCollision();
|
||||
setId(STEP_ID);
|
||||
}
|
||||
|
||||
BrickBlock::BrickBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
BrickBlock::BrickBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, BRICK_SRC, true) {
|
||||
ensureCollision();
|
||||
setId(BRICK_ID);
|
||||
@ -327,16 +320,14 @@ TreePlatformBarkBlock::TreePlatformBarkBlock(
|
||||
|
||||
WaterTopBlock::WaterTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture, WATER_TOP_SRC,
|
||||
false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, WATER_TOP_SRC, false) {
|
||||
ensureCollision();
|
||||
setId(WATER_TOP_ID);
|
||||
}
|
||||
|
||||
WaterFillBlock::WaterFillBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture, WATER_FILL_SRC,
|
||||
false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, WATER_FILL_SRC, false) {
|
||||
ensureCollision();
|
||||
setId(WATER_FILL_ID);
|
||||
}
|
||||
@ -383,8 +374,7 @@ MushroomPlatformBarkBottomBlock::MushroomPlatformBarkBottomBlock(
|
||||
|
||||
TreeBarkBlock::TreeBarkBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_terrain_texture, TREE_BARK_SRC,
|
||||
false ) {
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, TREE_BARK_SRC, false) {
|
||||
ensureCollision();
|
||||
setId(TREE_BARK_ID);
|
||||
}
|
||||
@ -413,8 +403,8 @@ TreeLeavesBottomBlock::TreeLeavesBottomBlock(
|
||||
setId(TREE_LEAVES_BOTTOM_ID);
|
||||
}
|
||||
|
||||
CannonTowerBlock::CannonTowerBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer )
|
||||
CannonTowerBlock::CannonTowerBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_terrain_texture, CANNON_TOWER_SRC,
|
||||
false) {
|
||||
ensureCollision();
|
||||
@ -442,12 +432,13 @@ DestructibleModifierBlock::DestructibleModifierBlock(
|
||||
false) {
|
||||
setId(DESTRUCTIBLE_MODIFIER_ID);
|
||||
}
|
||||
|
||||
BackgroundModifierBlock::BackgroundModifierBlock(
|
||||
int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock( x, y, renderer, g_mod_texture, MOD_BACKGROUND_SRC,
|
||||
false ) {
|
||||
: MarioBlock(x, y, renderer, g_mod_texture, MOD_BACKGROUND_SRC, false) {
|
||||
setId(BACKGROUND_MODIFIER_ID);
|
||||
}
|
||||
|
||||
MushroomModifierBlock::MushroomModifierBlock(
|
||||
int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
|
||||
: MarioBlock(x, y, renderer, g_mod_texture, MOD_MUSHROOM_SRC, false) {
|
||||
|
@ -7,275 +7,315 @@ class FloorBlock : public MarioBlock {
|
||||
public:
|
||||
FloorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class HillInclineBlock : public MarioBlock {
|
||||
public:
|
||||
HillInclineBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
HillInclineBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class HillDeclineBlock : public MarioBlock {
|
||||
public:
|
||||
HillDeclineBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
HillDeclineBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class HillDotsRightBlock : public MarioBlock {
|
||||
public:
|
||||
HillDotsRightBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class HillDotsLeftBlock : public MarioBlock {
|
||||
public:
|
||||
HillDotsLeftBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
HillDotsLeftBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class HillFillBlock : public MarioBlock {
|
||||
public:
|
||||
HillFillBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class HillTopBlock : public MarioBlock {
|
||||
public:
|
||||
HillTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class BushLeftBlock : public MarioBlock {
|
||||
public:
|
||||
BushLeftBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class BushMiddleBlock : public MarioBlock {
|
||||
public:
|
||||
BushMiddleBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
BushMiddleBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class BushRightBlock : public MarioBlock {
|
||||
public:
|
||||
BushRightBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
BushRightBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CloudLeftBottomBlock : public MarioBlock {
|
||||
public:
|
||||
CloudLeftBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CloudMiddleBottomBlock : public MarioBlock {
|
||||
public:
|
||||
CloudMiddleBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CloudRightBottomBlock : public MarioBlock {
|
||||
public:
|
||||
CloudRightBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CloudLeftTopBlock : public MarioBlock {
|
||||
public:
|
||||
CloudLeftTopBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
CloudLeftTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CloudMiddleTopBlock : public MarioBlock {
|
||||
public:
|
||||
CloudMiddleTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CloudRightTopBlock : public MarioBlock {
|
||||
public:
|
||||
CloudRightTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class PipeLeftBottomBlock : public MarioBlock {
|
||||
public:
|
||||
PipeLeftBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class PipeRightBottomBlock : public MarioBlock {
|
||||
public:
|
||||
PipeRightBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class PipeLeftTopBlock : public MarioBlock {
|
||||
public:
|
||||
PipeLeftTopBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
PipeLeftTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class PipeRightTopBlock : public MarioBlock {
|
||||
public:
|
||||
PipeRightTopBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
PipeRightTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CastleLeftBlock : public MarioBlock {
|
||||
public:
|
||||
CastleLeftBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
CastleLeftBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CastleRightBlock : public MarioBlock {
|
||||
public:
|
||||
CastleRightBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
CastleRightBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CastleBlackBlock : public MarioBlock {
|
||||
public:
|
||||
CastleBlackBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
CastleBlackBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CastleEntryBlock : public MarioBlock {
|
||||
public:
|
||||
CastleEntryBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
CastleEntryBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CastleTowerBlock : public MarioBlock {
|
||||
public:
|
||||
CastleTowerBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
CastleTowerBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CastleTowerFilledBlock : public MarioBlock {
|
||||
public:
|
||||
CastleTowerFilledBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class VineTopBlock : public MarioBlock {
|
||||
public:
|
||||
VineTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class VineBottomBlock : public MarioBlock {
|
||||
public:
|
||||
VineBottomBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
VineBottomBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class PoleTopBlock : public MarioBlock {
|
||||
public:
|
||||
PoleTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class PoleBottomBlock : public MarioBlock {
|
||||
public:
|
||||
PoleBottomBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
PoleBottomBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class FlagBlock : public MarioBlock {
|
||||
public:
|
||||
FlagBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class StepBlock : public MarioBlock {
|
||||
public:
|
||||
StepBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class BrickBlock : public MarioBlock {
|
||||
public:
|
||||
BrickBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class BrickTopBlock : public MarioBlock {
|
||||
public:
|
||||
BrickTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class SidewayPipeEndTopBlock : public MarioBlock {
|
||||
public:
|
||||
SidewayPipeEndTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class SidewayPipeEndBottomBlock : public MarioBlock {
|
||||
public:
|
||||
SidewayPipeEndBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class SidewayPipeMiddleTopBlock : public MarioBlock {
|
||||
public:
|
||||
SidewayPipeMiddleTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class SidewayPipeMiddleBottomBlock : public MarioBlock {
|
||||
public:
|
||||
SidewayPipeMiddleBottomBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
SidewayPipeMiddleBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class SidewayPipeConnectorTopBlock : public MarioBlock {
|
||||
public:
|
||||
SidewayPipeConnectorTopBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
SidewayPipeConnectorTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class SidewayPipeConnectorBottomBlock : public MarioBlock {
|
||||
public:
|
||||
SidewayPipeConnectorBottomBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
SidewayPipeConnectorBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreePlatformTopLeftBlock : public MarioBlock {
|
||||
public:
|
||||
TreePlatformTopLeftBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreePlatformTopMiddleBlock : public MarioBlock {
|
||||
public:
|
||||
TreePlatformTopMiddleBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreePlatformTopRightBlock : public MarioBlock {
|
||||
public:
|
||||
TreePlatformTopRightBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreePlatformBarkBlock : public MarioBlock {
|
||||
public:
|
||||
TreePlatformBarkBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class WaterTopBlock : public MarioBlock {
|
||||
public:
|
||||
WaterTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class WaterFillBlock : public MarioBlock {
|
||||
public:
|
||||
WaterFillBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
WaterFillBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class MushroomPlatformTopLeftBlock : public MarioBlock {
|
||||
public:
|
||||
MushroomPlatformTopLeftBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
MushroomPlatformTopLeftBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class MushroomPlatformTopMiddleBlock : public MarioBlock {
|
||||
public:
|
||||
MushroomPlatformTopMiddleBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
MushroomPlatformTopMiddleBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class MushroomPlatformTopRightBlock : public MarioBlock {
|
||||
public:
|
||||
MushroomPlatformTopRightBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
MushroomPlatformTopRightBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class MushroomPlatformBarkTopBlock : public MarioBlock {
|
||||
public:
|
||||
MushroomPlatformBarkTopBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
MushroomPlatformBarkTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class MushroomPlatformBarkBottomBlock : public MarioBlock {
|
||||
public:
|
||||
MushroomPlatformBarkBottomBlock(
|
||||
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
MushroomPlatformBarkBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreeBarkBlock : public MarioBlock {
|
||||
public:
|
||||
TreeBarkBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreeLeavesSmallBlock : public MarioBlock {
|
||||
public:
|
||||
TreeLeavesSmallBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreeLeavesTopBlock : public MarioBlock {
|
||||
public:
|
||||
TreeLeavesTopBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class TreeLeavesBottomBlock : public MarioBlock {
|
||||
public:
|
||||
TreeLeavesBottomBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CannonTowerBlock : public MarioBlock {
|
||||
public:
|
||||
CannonTowerBlock( int x, int y,
|
||||
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||
CannonTowerBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CannonPedestalBlock : public MarioBlock {
|
||||
public:
|
||||
CannonPedestalBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class CannonBlock : public MarioBlock {
|
||||
public:
|
||||
CannonBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
@ -287,11 +327,13 @@ public:
|
||||
DestructibleModifierBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class BackgroundModifierBlock : public MarioBlock {
|
||||
public:
|
||||
BackgroundModifierBlock(int x, int y,
|
||||
std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||
};
|
||||
|
||||
class MushroomModifierBlock : public MarioBlock {
|
||||
public:
|
||||
MushroomModifierBlock(int x, int y,
|
||||
|
@ -43,7 +43,8 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
|
||||
right = true;
|
||||
} else if (from == MARIO_TOP_DETECT) {
|
||||
top_hit = true;
|
||||
} else if (from == MARIO_TOP_LEFT_DETECT || from == MARIO_TOP_RIGHT_DETECT) {
|
||||
} else if (from == MARIO_TOP_LEFT_DETECT ||
|
||||
from == MARIO_TOP_RIGHT_DETECT) {
|
||||
rightleftpos = obj.getPos();
|
||||
top_left_right = true;
|
||||
}
|
||||
|
@ -8,7 +8,11 @@
|
||||
|
||||
class MarioVisitor : public SDLPP::Visitor {
|
||||
public:
|
||||
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &quit, int &coin_count, std::vector< std::shared_ptr< MarioBlock > > &moving_objects) : jumping(is_jumping), _scene(scene), _quit(quit), _coin_count(coin_count), _moving_objects(moving_objects) {}
|
||||
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &quit,
|
||||
int &coin_count,
|
||||
std::vector<std::shared_ptr<MarioBlock>> &moving_objects)
|
||||
: jumping(is_jumping), _scene(scene), _quit(quit),
|
||||
_coin_count(coin_count), _moving_objects(moving_objects) {}
|
||||
void visit(const SDLPP::RenderObject &obj) override;
|
||||
bool isOnGround() const {
|
||||
return onGround;
|
||||
|
@ -11,13 +11,18 @@ getVisitor( const MarioBlock &block, SDLPP::Scene &scene, bool &quit,
|
||||
std::shared_ptr<SDLPP::Visitor> result{};
|
||||
switch (block.getId()) {
|
||||
case MARIO_ID:
|
||||
result = std::static_pointer_cast<SDLPP::Visitor>(std::make_shared<MarioVisitor>(block.getMovement().getY() < 0, scene, quit, coin_count, moving_objects));
|
||||
result = std::static_pointer_cast<SDLPP::Visitor>(
|
||||
std::make_shared<MarioVisitor>(block.getMovement().getY() < 0,
|
||||
scene, quit, coin_count,
|
||||
moving_objects));
|
||||
break;
|
||||
case MUSHROOM_ID:
|
||||
result = std::static_pointer_cast<SDLPP::Visitor>(std::make_shared<MushroomVisitor>());
|
||||
result = std::static_pointer_cast<SDLPP::Visitor>(
|
||||
std::make_shared<MushroomVisitor>());
|
||||
break;
|
||||
case GOOMBA_ID:
|
||||
result = std::static_pointer_cast<SDLPP::Visitor>(std::make_shared<GoombaVisitor>());
|
||||
result = std::static_pointer_cast<SDLPP::Visitor>(
|
||||
std::make_shared<GoombaVisitor>());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user