Mario: prepartations for multiple moving objects
This commit is contained in:
+7
-2
@@ -5,7 +5,8 @@
|
||||
#include "editor_visitor.hpp"
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include "mario_visitor.hpp"
|
||||
#include "visitors/mario_visitor.hpp"
|
||||
#include "visitors/bounce_visitor.hpp"
|
||||
#include "blocks/simpleblocks.hpp"
|
||||
#include "blocks/coineditorblock.hpp"
|
||||
#include "blocks/coinblock.hpp"
|
||||
@@ -49,7 +50,7 @@ void MarioBlock::visit( SDLPP::Visitor &visitor ) {
|
||||
|
||||
setPos( getPos() - SDLPP::Vec2D< double >( 0, BLOCK_SIZE ) );
|
||||
if ( getCollisions().size() < 2 )
|
||||
addCollision( SDLPP::RectColider( 0.1, 0.1, 0.8, 0.8, 69 ) );
|
||||
addCollision( SDLPP::RectColider( 0.1, 0.1, 0.8, 0.8, BOUNCE_COLLISION ) );
|
||||
updateSizeAndPosition();
|
||||
g_playground->visitCollisions( *this, bv );
|
||||
setPos( getPos() + SDLPP::Vec2D< double >( 0, BLOCK_SIZE ) );
|
||||
@@ -494,18 +495,22 @@ createBlockById( uint64_t id, int x, int y,
|
||||
result = std::static_pointer_cast< MarioBlock >(
|
||||
std::make_shared< BackgroundModifierBlock >( x, y, renderer ) );
|
||||
break;
|
||||
#ifdef EDITOR
|
||||
case COIN_MODIFIER_ID:
|
||||
result = std::static_pointer_cast< MarioBlock >(
|
||||
std::make_shared< CoinEditorBlock >( x, y, renderer ) );
|
||||
break;
|
||||
#endif
|
||||
case MUSHROOM_MODIFIER_ID:
|
||||
result = std::static_pointer_cast< MarioBlock >(
|
||||
std::make_shared< MushroomModifierBlock >( x, y, renderer ) );
|
||||
break;
|
||||
#ifndef EDITOR
|
||||
case COIN_ID:
|
||||
result = std::static_pointer_cast< MarioBlock >(
|
||||
std::make_shared< CoinBlock >( x, y, renderer ) );
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user