Mario: add a dictionary of flags for each block

This commit is contained in:
2021-05-31 18:54:59 +02:00
parent af3954cb61
commit 243c1d9d04
4 changed files with 137 additions and 28 deletions
+6 -5
View File
@@ -11,7 +11,7 @@ struct LandType {
class MarioBlock : public SDLPP::RectangleRender {
public:
MarioBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > renderer,
std::shared_ptr< SDLPP::Texture > texture, SDL_Rect src, bool destructible = false );
std::shared_ptr< SDLPP::Texture > texture, SDL_Rect src, bool can_be_destroyed = false, bool destructible = false );
void visit( SDLPP::Visitor &visitor ) override;
void setTool( bool tool = true );
void setTerrain( bool terrain = true );
@@ -24,6 +24,7 @@ private:
bool _tool = false;
bool _terrain = true;
bool _destructible = false;
bool _can_be_destroyed = false;
bool _bouncing = false;
const int bounce_ticks = 100;
int ticks_to_bounce = bounce_ticks;
@@ -48,21 +49,21 @@ struct BlockRole {
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer,
bool collision = false, bool destructible = false );
bool destructible = false, bool editor = false );
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer, int x, int y,
bool collision = false, bool destructible = false );
bool destructible = false, bool editor = false );
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer,
std::shared_ptr< SDLPP::Texture > texture,
bool collision = false, bool destructible = false );
bool destructible = false, bool editor = false );
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer, int x, int y,
std::shared_ptr< SDLPP::Texture > texture,
bool collision = false, bool destructible = false );
bool destructible = false, bool editor = false );
std::shared_ptr< SDLPP::RectangleRender >
createMario( LandType::Value type, std::shared_ptr< SDLPP::Renderer > &renderer,
int x, int y );